|
| View previous topic :: View next topic |
| Author |
Message |
Guest
|
Posted: Wed Dec 19, 2007 7:15 pm Post subject: Public Function Port Test |
|
|
Hi everybody!
I'm new here and I desperatly need help. With the following function I
try to see a a device:
Public Function PortTest(COMPortNummer As Integer) As Boolean
MSComm1.CommPort = COMPortNummer
On Error Resume Next
MSComm1.PortOpen = True
If Err = 0 Then
PortTest = True
MSComm1.PortOpen = False
Else
PortTest = False
MSComm1.PortOpen = False
End If
End Function
For Portzaehler = 1 To 16
If PortTest(Portzaehler) Then
MsgBox "COM" + Str(Portzaehler) + " verfügbar"
End If
Next
The problem is that the compiler says to me that the command
"MSComm1." is error. It seems that I have to put a definition, and I
have no clue how to do it. I'm not a programmer, but I urgently need a
solution. Might it be that I have to add a line like "MSComm1.CommPort
= 1", and if yes, where to put it? Thank you for any kind of help!
Best wishes, Gremlin |
|
| Back to top |
|
 |
Google Sponsor

|
Posted: Wed Dec 19, 2007 7:15 pm Post subject: Advertisement |
|
|
|
|
| Back to top |
|
 |
Guest
|
Posted: Wed Dec 19, 2007 7:21 pm Post subject: Re: Public Function Port Test |
|
|
On 19 Dez., 20:15, ksj...@gmail.com wrote:
| Quote: | Hi everybody!
I'm new here and I desperatly need help. With the following function I
try to see a a device:
Public Function PortTest(COMPortNummer As Integer) As Boolean
MSComm1.CommPort = COMPortNummer
On Error Resume Next
MSComm1.PortOpen = True
If Err = 0 Then
PortTest = True
MSComm1.PortOpen = False
Else
PortTest = False
MSComm1.PortOpen = False
End If
End Function
For Portzaehler = 1 To 16
If PortTest(Portzaehler) Then
MsgBox "COM" + Str(Portzaehler) + " verfügbar"
End If
Next
The problem is that the compiler says to me that the command
"MSComm1." is error. It seems that I have to put a definition, and I
have no clue how to do it. I'm not a programmer, but I urgently need a
solution. Might it be that I have to add a line like "MSComm1.CommPort
= 1", and if yes, where to put it? Thank you for any kind of help!
Best wishes, Gremlin
|
If someone could send me the example code in english (mine is german
version) would be even better! |
|
| Back to top |
|
 |
Tony Strazzeri Guest
|
Posted: Thu Dec 20, 2007 8:39 am Post subject: Re: Public Function Port Test |
|
|
I think you don't have any resource that communicates with the comm
port. VBA certainly doesn't have this. I think this may be available
in the "MSComm32.ocx" Activex control. If you have it installed you
can add a reference to it from your VBA IDE under References.
I think it odd that you are posting the query to an MS Word group.
Anyway a quick search using "how to open CommPort vba" came up with a
couple of worthwhile directions including the above control.
Have a look at these;
http://www.tech-archive.net/Archive/Excel/microsoft.public.excel.programming/2004-05/7068.html
http://mc-computing.com/languages/SerialIO.htm
http://www.activexperts.com/activcomport/howto/vba/
I can't vouch for any of these but they seemed worth a look.
Good Luck
Cheers
TonyS.
On Dec 20, 6:21 am, ksj...@gmail.com wrote:
| Quote: | On 19 Dez., 20:15, ksj...@gmail.com wrote:
Hi everybody!
I'm new here and I desperatly need help. With the following function I
try to see a a device:
Public Function PortTest(COMPortNummer As Integer) As Boolean
MSComm1.CommPort = COMPortNummer
On Error Resume Next
MSComm1.PortOpen = True
If Err = 0 Then
PortTest = True
MSComm1.PortOpen = False
Else
PortTest = False
MSComm1.PortOpen = False
End If
End Function
For Portzaehler = 1 To 16
If PortTest(Portzaehler) Then
MsgBox "COM" + Str(Portzaehler) + " verfügbar"
End If
Next
The problem is that the compiler says to me that the command
"MSComm1." is error. It seems that I have to put a definition, and I
have no clue how to do it. I'm not a programmer, but I urgently need a
solution. Might it be that I have to add a line like "MSComm1.CommPort
= 1", and if yes, where to put it? Thank you for any kind of help!
Best wishes, Gremlin
If someone could send me the example code in english (mine is german
version) would be even better! |
|
|
| Back to top |
|
 |
Guest
|
Posted: Thu Dec 20, 2007 3:07 pm Post subject: Re: Public Function Port Test |
|
|
On 20 Dez., 09:39, Tony Strazzeri <frees...@fastmail.fm> wrote:
| Quote: | I think you don't have any resource that communicates with the comm
port. VBA certainly doesn't have this. I think this may be available
in the "MSComm32.ocx" Activex control. If you have it installed you
can add a reference to it from your VBA IDE under References.
I think it odd that you are posting the query to an MS Word group.
Anyway a quick search using "how to open CommPort vba" came up with a
couple of worthwhile directions including the above control.
Have a look at these;
http://www.tech-archive.net/Archive/Excel/microsoft.public.excel.prog...http://mc-computing.com/languages/SerialIO.htmhttp://www.activexperts.com/activcomport/howto/vba/
I can't vouch for any of these but they seemed worth a look.
Good Luck
Cheers
TonyS.
On Dec 20, 6:21 am, ksj...@gmail.com wrote:
On 19 Dez., 20:15, ksj...@gmail.com wrote:
Hi everybody!
I'm new here and I desperatly need help. With the following function I
try to see a a device:
Public Function PortTest(COMPortNummer As Integer) As Boolean
MSComm1.CommPort = COMPortNummer
On Error Resume Next
MSComm1.PortOpen = True
If Err = 0 Then
PortTest = True
MSComm1.PortOpen = False
Else
PortTest = False
MSComm1.PortOpen = False
End If
End Function
For Portzaehler = 1 To 16
If PortTest(Portzaehler) Then
MsgBox "COM" + Str(Portzaehler) + " verfügbar"
End If
Next
The problem is that the compiler says to me that the command
"MSComm1." is error. It seems that I have to put a definition, and I
have no clue how to do it. I'm not a programmer, but I urgently need a
solution. Might it be that I have to add a line like "MSComm1.CommPort
= 1", and if yes, where to put it? Thank you for any kind of help!
Best wishes, Gremlin
If someone could send me the example code in english (mine is german
version) would be even better!
|
Thank you very much Tony!
I'm sorry about posting the message to a word group.
I realized afterwards that this is not a general vba discussion. |
|
| Back to top |
|
 |
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
|
|