VBA Function | Returns | Description |
---|---|---|
start_com_port |
Boolean 1 |
Starts com port with existing settings |
start_com_port("baud=1200") |
Boolean 1 |
Starts com port with supplied settings 2 in string |
start_com_port(SCANNER) |
Boolean 1 |
Starts com port with settings 2 defined in VBA constant or variable SCANNER |
check_com_port |
Long |
Returns number of read characters waiting. -1 indicates error |
get_com_port |
String |
Returns a single waiting character string from com port |
read_com_port |
String 3 |
Returns waiting character string from com port |
put_com_port("A") |
Boolean 1 |
Send a single character string to com port |
send_com_port("QWERTY") |
Boolean 1 |
Sends 4 supplied character string to com port |
send_com_port(COMMANDS) |
Boolean 1 |
Sends 4 character string defined in VBA constant or variable COMMANDS to com port |
send_com_port($B$5) |
Boolean 1 |
Sends 5 contents of Cell $B$5 to com port (Excel Worksheet Only) |
device_ready |
Boolean |
Returns True if port started and Data Set Ready (DSR) input signal active |
stop_com_port |
Boolean 1 |
Stops com port and returns its control back to Windows |
Private Const COM_PORT_NUMBER as Long = 1
Footnotes
-
Function returns
True
if successful, otherwiseFalse
↩ ↩2 ↩3 ↩4 ↩5 ↩6 ↩7 ↩8 -
Port settings if supplied should have the same structure as the equivalent command-line Mode arguments for a COM Port ↩ ↩2
-
Maximum characters returned = read buffer length (fixed value)
More waiting characters beyond buffer length may remain unread.
Usecheck_com_port
to confirm any remaining character count if required. ↩ -
Function will block until all characters are sent or write timer expires.
Maximum characters sent limited by timerWrite_Total_Timeout_Constant
value. ↩ ↩2 -
Excel will re-send if Cell $B$5 value changes ↩