i also hav some problem where getting the error 8005 'port already open' even though it isnt really open. here my code where it is actually to ectract data from com port
hope u guys can help..thanx..-_-Code:Private Sub MSComm1_OnComm() If Worksheets("SerialPort").MSComm1.CommEvent = comEvReceive Then Call GetData End If End Sub Sub OpenPort() 'Open the COM Port with the relevant settings Worksheets("SerialPort").MSComm1.CommPort = 1 Worksheets("SerialPort").MSComm1.Settings = "9600,n,8,1" Worksheets("SerialPort").MSComm1.RThreshold = 1 Worksheets("SerialPort").MSComm1.InBufferSize = 4096 Worksheets("SerialPort").MSComm1.PortOpen = True End Sub Private Sub GetData() Dim MyData As String Wokrsheets("SerialPort").MSComm1.InputLen = 0 MyData = Worksheets("SerialPort").MSComm1.Input ActiveCell.Value = MyData MyData = "" Worksheets("SerialPort").MSComm1.PortOpen = False End Sub Private Sub Worksheet_SelectionChange(ByVal Target As Range) If Not Intersect(Target, Columns("A:A")) Is Nothing Then If Target.Value = "" Then Call OpenPort End If End If Application.EnableEvents = True End Sub


Reply With Quote
