This macro creates an event (#1) that occurs when the string "Help" is received from the host:
Sub CreateStringEvent()
Session.DefineEvent 1, rcDisplayString, "", "Help", rcAnyRow, rcAnyCol, 1
End Sub
This event procedure checks to see if event #1 has been triggered. If this is the case, it displays a message box with more information and resets the event.
Private Sub Session_DefinedEvent(ByVal EventNumber As Long, _
ByVal EventType As Long, _
ByVal TheString As String, _
ByVal Row As Long, _
ByVal Column As Long, _
ByVal Key As Long)
If EventNumber = 1 Then
'Display a message using the returned string as message title
MsgBox "Contact Joe for more information.",,TheString
'Reset the Event
ResetEvent 1
End If
End Sub
Notes:
· The underscore line continuation character is used to break up long lines of code in this example.