Reply
 
Thread Tools Display Modes
  #1   Report Post  
Posted to microsoft.public.word.docmanagement
Neron[_11_] Neron[_11_] is offline
external usenet poster
 
Posts: 2
Default 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   Report Post  
Posted to microsoft.public.word.docmanagement
Jay Freedman Jay Freedman is offline
external usenet poster
 
Posts: 9,854
Default 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   Report Post  
Posted to microsoft.public.word.docmanagement
Jay Freedman Jay Freedman is offline
external usenet poster
 
Posts: 9,854
Default 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   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
  #5   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
Reply
Thread Tools
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
I can see my Cut & Paste button but when I click nothing happens Marg Microsoft Word Help 1 September 15th 09 12:35 AM
Right Click Mouse button [email protected] Microsoft Word Help 2 January 2nd 08 03:34 PM
Detect Click Event of Built in Button [email protected] Microsoft Word Help 1 March 15th 07 07:04 PM
In the edit button the seclet button is gray and i can't click on tiffany Microsoft Word Help 0 February 16th 07 04:26 PM
add a command button and when i click on the button it will copy ronabriones Microsoft Word Help 1 June 22nd 06 07:38 PM


All times are GMT +1. The time now is 06:30 AM.

Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 Microsoft Office Word Forum - WordBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Word"