Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.word.docmanagement
|
|||
|
|||
Catch click event button
Hi all, I was wondering... Is it possible to "catch" a click-event on a BuildIn Offie Button? In order to execute your own VBA-code? e.g. I want to be able to catch the "Undo" button in order to execute a piece of macro code in stead of just "Undoing" only the last action. Greetz, Bert -- Neron |
#2
Posted to microsoft.public.word.docmanagement
|
|||
|
|||
Catch click event button
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. On Mon, 22 Mar 2010 12:37:07 -0400, Neron wrote: Hi all, I was wondering... Is it possible to "catch" a click-event on a BuildIn Offie Button? In order to execute your own VBA-code? e.g. I want to be able to catch the "Undo" button in order to execute a piece of macro code in stead of just "Undoing" only the last action. Greetz, Bert |
#3
Posted to microsoft.public.word.docmanagement
|
|||
|
|||
Catch click event button
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. On Mon, 22 Mar 2010 12:37:07 -0400, Neron wrote: Hi all, I was wondering... Is it possible to "catch" a click-event on a BuildIn Offie Button? In order to execute your own VBA-code? e.g. I want to be able to catch the "Undo" button in order to execute a piece of macro code in stead of just "Undoing" only the last action. Greetz, Bert |
#4
Posted to microsoft.public.word.docmanagement
|
|||
|
|||
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 |
#5
Posted to microsoft.public.word.docmanagement
|
|||
|
|||
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 |
Reply |
Thread Tools | |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
I can see my Cut & Paste button but when I click nothing happens | Microsoft Word Help | |||
Right Click Mouse button | Microsoft Word Help | |||
Detect Click Event of Built in Button | Microsoft Word Help | |||
In the edit button the seclet button is gray and i can't click on | Microsoft Word Help | |||
add a command button and when i click on the button it will copy | Microsoft Word Help |