Author Topic: kernel32: Excel VBA: Cannot talk to port >COM4  (Read 22135 times)

IanWade

  • Member
  • ***
  • Posts: 2
kernel32: Excel VBA: Cannot talk to port >COM4
« 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.

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

Jan Axelson

  • Administrator
  • Frequent Contributor
  • *****
  • Posts: 3033
    • Lakeview Research
Re: kernel32: Excel VBA: Cannot talk to port >COM4
« Reply #1 on: November 13, 2011, 11:00:39 am »
Did you increase the value of MAX_PORTS?

Jan

IanWade

  • Member
  • ***
  • Posts: 2
[SOLVED] Re: kernel32: Excel VBA: Cannot talk to port >COM4
« Reply #2 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
« Last Edit: November 13, 2011, 01:01:54 pm by IanWade »