0

How to read a COM port (serial) with a VBA macro in Excel ?

I red miles of forums/publications/... and tried to make a very simple code working : open the port with Open, read via Input or Get functions, ... I got nothing at all. When I use Hyper Terminal or similar applications, I can get the text lines running on my COM port.

The code works (don't get any error), but I don't get any characters at the end.

Is there any Excel setting for using this technique, or is there any tecghnical issue that keeps from reading a serial port with Excel ? Thanx in advance for your feedback.

My code principle :

MySub()
  ...
  Open "COM3:4800,N,8,1" For Random As #zPortCom Len = 1
  ...
  While ...
    ...
    Get #zPortCom, , zChar   '=> I get an empty answer !!!!!!!
  Wend
  ...
  Close #zPortCom
end sub
braX
  • 11,506
  • 5
  • 20
  • 33
  • Does this answer your question? [What is the best way to access a serial port from VBA?](https://stackoverflow.com/questions/569698/what-is-the-best-way-to-access-a-serial-port-from-vba) – braX May 23 '23 at 13:42

0 Answers0