Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

mouse events in MS Word 2007

99 views
Skip to first unread message

PC Faris

unread,
Apr 21, 2010, 3:30:41 PM4/21/10
to
Based on:
http://word.mvps.org/FAQs/MacrosVBA/

I tried to create a class module for oApp to handle events.
I get the oApp dropdown with then populates the VB editor with a list of
events, but they don't work.
I did this in the document itself and not in a template; and I run the
startoApp() manually instead of AutoExic, but this shouldn't matter, right?
So why doesn't it work?

See code (which I used in the class module) below.

Thanks,
Phil


Option Explicit
Dim oAppClass As New ThisApplication
Public WithEvents oApp As Word.Application

Public Sub startoApp()
Set oAppClass.oApp = Word.Application
End Sub

Private Sub oApp_WindowBeforeDoubleClick(ByVal Sel As Selection, Cancel As
Boolean)
MsgBox "crick crick"
End Sub

Klaus Linke

unread,
Apr 29, 2010, 12:18:49 PM4/29/10
to

"PC Faris" <p...@connects.org> schrieb im Newsbeitrag
news:9B1326A9-D503-45FE...@microsoft.com...
> Based on:
> http://word.mvps.org/FAQs/MacrosVBA/

Specifically,
http://word.mvps.org/FAQs/MacrosVBA/AppClassEvents.htm

Works fine for me...

Just to make sure what goes where:

Some code module:


Option Explicit
Dim oAppClass As New ThisApplication

Public Sub startoApp()


Set oAppClass.oApp = Word.Application
End Sub

Class module with name "ThisApplication":
Option Explicit


Public WithEvents oApp As Word.Application

Private Sub oApp_WindowBeforeDoubleClick(ByVal Sel As Selection, Cancel As
Boolean)
MsgBox "Just us crickets!"
End Sub


Regards,
Klaus

0 new messages