PORTS Forum

Ports and Interfaces => Serial Ports => Topic started by: IanWade on November 12, 2011, 05:10:59 pm

Title: kernel32: Excel VBA: Cannot talk to port >COM4
Post by: IanWade on November 12, 2011, 05:10:59 pm
I am writing Excel VBA code for serial I/O, with Windows XP and kernel32, using the code example from http://dev.emcelettronica.com/serial-port-communication-excel-vba (http://dev.emcelettronica.com/serial-port-communication-excel-vba).

This works fine for COM1 thru COM4. No problems. But when I attempt to address any port number greater than COM4, the "CommOpen"  function returns a lngStatus value of 9, which I take to mean "invalid port number".

Near the bottom of the same page, someone says that by changing the root of the port name from "COM" to "\\.\COM" you can use up to COM256. But I can't make this work.

Has anyone here made it work?

--
Ian
Title: Re: kernel32: Excel VBA: Cannot talk to port >COM4
Post by: Jan Axelson on November 13, 2011, 11:00:39 am
Did you increase the value of MAX_PORTS?

Jan
Title: [SOLVED] Re: kernel32: Excel VBA: Cannot talk to port >COM4
Post by: IanWade on November 13, 2011, 12:55:17 pm
Did you increase the value of MAX_PORTS?

Jan

Er, no. I was concentrating on the requirements for passing parameters to kernel32, and missed that particular line.  ::) Thanks Jan.

Ian