Click here to Skip to main content
15,886,689 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
E.g. I want to send this string of text "23423,10,20,Planning,2,1,Drop Off" from Sheets("Sheet1").Range("A1") through serial port.

What I have tried:

Currently, I'm using this and it managed to open the port but the result appeared as /xFF etc. 


COMPort = FreeFile
     Close #COMPort

    Open "COM5:9600,N,8,1" For Binary Access Read Write As #COMPort
    VarString$ = String$(10, " ")
    Put #COMPort, , VarString$
    Close #COMPort
Posted
Updated 3-Apr-20 4:54am
v2
Comments
Richard MacCutchan 2-Apr-20 4:28am    
So what is the problem?
Roboz 2-Apr-20 4:29am    
Hi, i'm new to VBA so i'm not sure how to send the string
CHill60 2-Apr-20 4:40am    
But you have sent the string. Where is the result appearing?
Richard MacCutchan 2-Apr-20 5:11am    
If you can send a single character then you just need to write a loop to send each character of the string.
CHill60 2-Apr-20 4:53am    
What are you sending this string to? How are you determining that the "result" is /xFF? What are you communicating with via the serial port?

1 solution

Take a look here: Perform Serial Port Communication from VB[^]
The usage of code is the same as in VBA.

See similar question on SO: What is the best way to access a serial port from VBA? - Stack Overflow[^]
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900