OT: VBA COM ports > 9 [Windows 10]

Aug 07, 2020 2 Replies
Saved reading
Jump to replies (2)

Sorry, much OT but you're a clever lot! I'm trying to open a COM port in VBA (Excel) using: Open COMString For Binary Access Read Write As #1 Where COMString is "COM2:500000,N,8,1"



Now this works fine for ports less than 10, but my COM port is number 12 and it will be a PITA to select manually a different one in device mgr.



My Googling only returns suggestions for use with C/C++. Any ideas? Ta.


I can see how you'd specify the high port numbers as "\\.\COM12" but I don't think you'd combine that with your ":speed,parity,databits,stopbits" suffix

do you actually have more than 9 serial ports existing? if not there's ways and means to reset the numbers so they don't exceed COM9, e.g.

but if e.g you have USB serial dongles without hardware serial numbers, they'll just build up each time you unplug/replug instead of re-using the old number.

I'm far from being a VBA (or even MS Windows) expert but is there a chance that the COM port is in Hex? So after COM9 it would go COMA, COMB, COMC, etc.

Join the Discussion

Have something to add? Share your thoughts — no account required.

Didn't find your answer?

Ask the community — no account required