S
shawnk
I have a word document with the following AutoExec macro, where i'm
attempting to detect the click event of a built in word toolbar
button. In this case the numbering icon from the E-Mail menu.
Sub AutoExec()
Set MyControl = New Class1
End Sub
Which also has the following class module named Class1
Public WithEvents MyControl As Office.CommandBarButton
Private Sub MyControl_Click(ByVal Ctrl As Office.CommandBarButton,
CancelDefault As Boolean)
MsgBox "Numbering Clicked"
CancelDefault = True
End Sub
Private Sub Class_Initialize()
Set MyControl = Application.CommandBars.FindControl(ID:=11)
End Sub
Can anyone help me understand what i'm doing wrong? The click event
does not trigger.
Shawn
attempting to detect the click event of a built in word toolbar
button. In this case the numbering icon from the E-Mail menu.
Sub AutoExec()
Set MyControl = New Class1
End Sub
Which also has the following class module named Class1
Public WithEvents MyControl As Office.CommandBarButton
Private Sub MyControl_Click(ByVal Ctrl As Office.CommandBarButton,
CancelDefault As Boolean)
MsgBox "Numbering Clicked"
CancelDefault = True
End Sub
Private Sub Class_Initialize()
Set MyControl = Application.CommandBars.FindControl(ID:=11)
End Sub
Can anyone help me understand what i'm doing wrong? The click event
does not trigger.
Shawn