G
Greg Maxey
With Word2003 I could create an event monitor to detect when a user used a
command bar button. For example, the following is used to detect use of the
"Print..." command:
Private WithEvents ctrlEvent As CommandBarButton
Sub AutoExec()
Set ctrlEvent = Application.CommandBars("Menu
Bar").Controls("File").Controls("Print...")
End Sub
Private Sub ctrlEvent_Click(ByVal Ctrl As CommandBarButton, CancelDefault As
Boolean)
CancelDefault = True
Select Case True
Case ActiveDocument.PageSetup.RightMargin > 72
MsgBox "Set green document margins and try again."
Case ActiveDocument.PageSetup.LeftMargin > 72
MsgBox "Set green document margins and try again."
Case Else
CancelDefault = False
End Select
End Sub
I could create the same effect with through a laborrious procress of
creating a custom ribbon that mimics the Office Menu Print control, but I
was wondering if anyone knows a way to monitor the built-in Ribbon events?
--
Greg Maxey
See my web site http://gregmaxey.mvps.org
for an eclectic collection of Word Tips.
Arrogance is a weed that grows mostly on a dunghill (Arabic proverb)
command bar button. For example, the following is used to detect use of the
"Print..." command:
Private WithEvents ctrlEvent As CommandBarButton
Sub AutoExec()
Set ctrlEvent = Application.CommandBars("Menu
Bar").Controls("File").Controls("Print...")
End Sub
Private Sub ctrlEvent_Click(ByVal Ctrl As CommandBarButton, CancelDefault As
Boolean)
CancelDefault = True
Select Case True
Case ActiveDocument.PageSetup.RightMargin > 72
MsgBox "Set green document margins and try again."
Case ActiveDocument.PageSetup.LeftMargin > 72
MsgBox "Set green document margins and try again."
Case Else
CancelDefault = False
End Select
End Sub
I could create the same effect with through a laborrious procress of
creating a custom ribbon that mimics the Office Menu Print control, but I
was wondering if anyone knows a way to monitor the built-in Ribbon events?
--
Greg Maxey
See my web site http://gregmaxey.mvps.org
for an eclectic collection of Word Tips.
Arrogance is a weed that grows mostly on a dunghill (Arabic proverb)