If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below. |
|
|
Thread Tools | Display Modes |
#1
|
|||
|
|||
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 |
#2
|
|||
|
|||
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
|
|||
|
|||
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 Quote:
Last edited by Neron : March 23rd, 2010 at 10:49 AM. |
Thread Tools | |
Display Modes | |
|
|