View Single Post
  #4   Report Post  
Posted to microsoft.public.word.docmanagement
Neron[_12_] Neron[_12_] is offline
external usenet poster
 
Posts: 2
Default Catch click event button


Hi Jay,

Thanks for the reply, but unfortunately this is not the macro / event I
hoped for.
The EditUndo-macro just intercepts the [Ctrl]+[Z] key press event, it
doesn't respond to the "Undo-button" in the Command Bar / Quick Access
Toolbar.

I've been trying to intercept an event directly from the control, but
unfortunately I can't seem to get this one working:

Public WithEvents m_Undo As Office.CommandBarComboBox
Public WithEvents m_Print As Office.CommandBarButton

Private Sub Document_New()
Set m_Undo = Application.CommandBars.FindControl(6, 128)
Set m_Print = Application.CommandBars.FindControl(1, 4)
End Sub

Private Sub Document_Open()
Set m_Undo = Application.CommandBars.FindControl(6, 128)
Set m_Print = Application.CommandBars.FindControl(1, 4)
End Sub

Private Sub m_Print_Click(ByVal Ctrl As Office.CommandBarButton,
CancelDefault As Boolean)
Call MsgBox("I can print", vbOKOnly)
End Sub

Private Sub m_Undo_Change(ByVal Ctrl As Office.CommandBarComboBox)
Call MsgBox("I can undo", vbOKOnly)
End Sub

Intercepting the Print button works just fine, but intercepting the
Undo-button... :-(

Greetz,

Bert


Jay Freedman;3681930 Wrote:
It is possible to catch ("intercept") most built-in Word commands, as
described at
http://www.word.mvps.org/FAQs/Macros...tSavePrint.htm.

In this case, the macro you need to write is named EditUndo, as in

Public Sub EditUndo()
' do your stuff here
End Sub

--
Regards,
Jay Freedman
Microsoft Word MVP FAQ: http://word.mvps.org
Email cannot be acknowledged; please post all follow-ups to the
newsgroup so all may benefit.






--
Neron