i am trying to read info sent from a device via comm port I get an error #35 "compilation error a sub or function has not been defined"
This is my code, can anyone help me
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 = 4
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