Make a Word event macro fire in active document

P

paul.robinson

Hi
This is a cross post originally to a Word programming group.
Unfortunately, you can practically see the tumbleweed blowing down the
main street of the Word groups...

If anyone in here could answer this I'd be most grateful:
I have an application level event macro (in class module) that creates
a popup menu

Public WithEvents WordApp As Word.Application
Private Sub WordApp_WindowBeforeRightClick(ByVal Sel As Selection,
Cancel As Boolean)
Make_FreePopUp
Cancel = True
End Sub

The document_open event macro in ThisDocument is

Private Sub Document_Open()
Set wdApplication.WordApp = Word.Application
End Sub

and in a general module I have

Public wdApplication As New Class1
Public Sub Make_FreePopUp()
'etc
End Sub

This works fine in its template document tester.dot. It also works fine

in the active document if tester.dot is open.
i've followed two suggestions as to how to make this available to the
active document without tester.dot being visible.
Try 1: put the template file in the startup folder
Try 2: go to Tools, templates and AddIns.. and add it to the Global
templates and AddIns list

Neither option fires the macro in the active document.
I don't want to change normal.dot as this will disable the normal right

click menu.

I'm completely new to word macros but know Excel VBA pretty well, where

i can simply put Is AddIn = True on the file and add it to the users
AddIn list. What is the equivalent process in Word??

Again, apologies for the cross post but this apparently simple issue is
driving me nuts.

regards
Paul
 
C

Carim

Hi Paul,

Had the same problem a while ago ...
If I recall correctly:
AddIns.Add FileName:= "C:\Test.dot" , Install:=True

HTH
Carim
 
P

paul.robinson

Hi Carim
Thanks for that - where does this go? In the ThisDocument open sub?

regards
Paul
 

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