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
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