how to capture the right-click event in MSWord through a word macro (visual basic macros)?

J

Jay

I want an action to be performed during the mouse right-click in MSWord.
how to capture the right-click event of MSWord(in a word macro)?
 
O

Ol

1) You have to create classmodule to capture events

2) Check that Application event: WindowBeforeRightClick


Private Sub App_WindowBeforeRightClick(ByVal Sel As Selection, Cancel As
Boolean)

End Sub
 
K

kjaysree

I've called the macro function that is to be trigerred during the
right-click, inside WindowBeforeRightClick, application event.

Private Sub App_WindowBeforeRightClick(ByVal Sel As Selection, Cancel
As
Boolean)

macro1.fn1(Sel)

End Sub

The application event(WindowBeforeRightClick) is not at all executed.
 
K

kjaysree

I've called the macro function that is to be trigerred during the
right-click, inside WindowBeforeRightClick, application event.

Private Sub App_WindowBeforeRightClick(ByVal Sel As Selection, Cancel
As
Boolean)

macro1.fn1(Sel)

End Sub

The application event(WindowBeforeRightClick) is not at all executed.
What could be the possible mistake? How can it be rectified?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top