A
A scale has an RS232 output that transmits the weight (ascii) when a button is pressed on the scale. I want to read this value at the PC COM port and place it into a worksheet cell. Why won't this work?
handle = FreeFile(0)
Open "COM2" For Input As handle
For SampleNo = 1 To nNumSamples
Input #handle, sLine
Sheet1.Cell(SampleNo+6,3).Formula = sLine
Next
To test this I connected my COM1 port to my COM2 port. Opening hyperterminal for both ports showed that my connection was fine. With hyperterminal transmitting out COM1 and COM2 receiving, the Open statement works fine, but when the Input # statement executes I get the following as soon as I enter a single character.
Run time Error 52
Bad file name or number
Ports are configured identically.
handle = FreeFile(0)
Open "COM2" For Input As handle
For SampleNo = 1 To nNumSamples
Input #handle, sLine
Sheet1.Cell(SampleNo+6,3).Formula = sLine
Next
To test this I connected my COM1 port to my COM2 port. Opening hyperterminal for both ports showed that my connection was fine. With hyperterminal transmitting out COM1 and COM2 receiving, the Open statement works fine, but when the Input # statement executes I get the following as soon as I enter a single character.
Run time Error 52
Bad file name or number
Ports are configured identically.