hi,
I found this code:
Dim iCOM1 As Integer
iCOM1 = FreeFile
Open "COM1" For Output As #iCOM1
Print #iCOM1, "M" & Chr(13)
Close #iCOM1
When I do this command, I'll get a string back.
Can somebody tell me how.
thanks
Printable View
hi,
I found this code:
Dim iCOM1 As Integer
iCOM1 = FreeFile
Open "COM1" For Output As #iCOM1
Print #iCOM1, "M" & Chr(13)
Close #iCOM1
When I do this command, I'll get a string back.
Can somebody tell me how.
thanks
all you need to do is this:
Code:Open "C:\hello.dat" for Output as #1
Print "Hello World"
Close #1
dear dimava,
Thanks for your input, but ...
I use the COM1 PORT to communicate with a other device.
When I give the "M" & Chr(13) command, then 1 second later
I get a string back. I need to capture this string through COM1.
R@emdonck
I've added comments to the code that might help you:
Code:Dim iCOM1 As Integer
'assigns iCOM1 to the next free file number
iCOM1 = FreeFile
'opens the file COM1
Open "COM1" For Output As #iCOM1
'the character M and carriage return are printed to the file
Print #iCOM1, "M" & Chr(13)
'file is closed
Close #iCOM1
Sunny
you should use the MSCOMM control to deal with com port stuff.
plus, always use a variable to store the filenumber, never use '#1' or any other explicit number, because in some cases, one application can overwrite data used in another!