GefObjectEvent.Key (read-only property)

Represents the key code of the key this event corresponds to.
Syntax: long = object.Key
Description: This property is only valid for events whose Type is gefEventKeyDown, gefEventKeyUp, or gefEventWhileKeyDown.

You can set this property with the SetKey method.

Example:

Sub GefObjectEvent_Key()
    
    Dim oCimObj As GefObject
    Dim oCimObjEvnts As GefObjectEvents
    Dim oCimObjEvnt As GefObjectEvent
    
    Set oCimObj = CimGetObject
    Set oCimObjEvnts = oCimObj.Events
    Set oCimObjEvnt = oCimObjEvnts.Item(0)
    
    MsgBox "The key that was pressed to active this " & _
        "script was " & Chr(oCimObjEvnt.Key)
    
End Sub