Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Read/Write to serial port using VBA-Excel

Status
Not open for further replies.

tallanwt

Programmer
Apr 2, 2019
1
US
running a macro using Excel for Office 365 (64bit) on Win10. All Trust settings adjusted accordingly.

Attachment shows module code.
On the form I have a button to run code:
lngStatus=CommOpen(gCOMPort, "COM" & Cstr(gCOMPort),_
("baud=9600 parity=Even data=8 stop=1")
'The port opens OK.

lngStatus=CommWrite(gCOMPort, "X/C" & CRLF)
Pause (2)
lngStatus=CommRead(gCOMPort, datastring, 7)
'Here's where things stop working. Result set does not return correct string. No errors-just not returning expected result.

What else I've tried.
Ran Realterm(serial capture program-sending same command "X/C" and other commands-results returned were correct.
Ran same Excel macro (removed PtrSafe from all Declare Function statements)on WinXP SP2 machine using Excel 2007-results returned were correct.

What I suspect (not validated yet)is Excel 32bit vs 64bit, but before I setup another machine I wanted to ask if any serial programmers
were aware of this issue or have a solution.

 
 https://files.engineering.com/getfile.aspx?folder=f72fa36d-b54f-42ab-ae42-97df911a6efe&file=ComPortMaster_for_64bit.txt
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top