For VB.net I wrote an article on "Visual Basic 2005 and the Serial Port" in the December 2006 edition of Circuit Cellar.
**broken link removed**
Circuit Cellar charges a nominal amount for most articles.
For VB5/6/VBA there are several sources. The best is "Serial Port Complete" by Jan Axelson. The latest edition may also cover VB.net. There are several other books- just search for "serial port" on Amazon. Richard Grier is a name to follow as well,. The book I used is out of print, but there appears to be a more recent version.
Only the professional and enterprise editions of VB came with the serial port control. You can of course acquire and install the control yourself. See the discussion
Forgive me if I take this opportunity to also tell you that there are two examples (chapters) that actually show you how to interface MS Excel to the serial port (plus one that uses the parallel port). The first describes an interface to a DVM and the second to a function generator.
The book is called "Excel by Example : A Microsoft Excel Cookbook for Electronics Engineers" ISBN 0750677562 (published by Elsevier) and is available in paperback or in electronic format. You can review the TOC and part of the first example at Amazon.com.
I have this Visual Basic 6 code who send in HEX 'FF 01 00' and 'FF 01 01' to RS232. Hope this help you.
Code:
Private Sub cmdOff_Click()
With MSComm1
'make sure the serial port is open
If .PortOpen = False Then .PortOpen = True
'send the data
.Output = Chr$(255)
.Output = Chr$(1)
.Output = Chr$(0)
End With 'MSComm1
End Sub
Private Sub cmdOn_Click()
With MSComm1
'make sure the serial port is open
If .PortOpen = False Then .PortOpen = True
'send the data
.Output = Chr$(255)
.Output = Chr$(1)
.Output = Chr$(1)
End With 'MSComm1
End Sub