AutoExec Macro

P

PMBO

I have this macro that is attached to a template (see below). It is stored
on a shared drive in a Portal for everyone to use. It should create a new
menu item called claims repository and then allow the user to use the menu.
It had been working for a long time, and recently it stopped working. If I
attach the macro to my normal.dot when I open Word the menu is always there
and always works perfectly. But if it's attached to the document I have to
RUN the macro for it to work. Because it was working in the past and I'm not
sure where the macro was stored originally (I didn't create it), I'm not sure
how they got it to work. Can anyone tell me where it should be stored to
work on everyone's machine when they click to open the template?

Sub AutoExec()

Set cb = CommandBars("Menu Bar").Controls("File")

'Add new menu item to File menu
TheMenuString = "Claims Repository"
TestString = cb.Controls(9).Caption

'Check to see if New Menu Item has already been added to
'the File file.
If TestString <> TheMenuString Then

'Add menu items to New Menu Item
Set NewMenuItem = cb.Controls.Add(Type:=msoControlPopup, Before:=9,
Temporary:=False)

cb.Controls(9).Caption = TheMenuString
Set NewCtrl1 = NewMenuItem.Controls.Add(Temporary:=False)

NewCtrl1.Caption = "Save to Claims Repository"
NewCtrl1.OnAction = "SaveToKM"

End If

cb = Null
NewMenuItem = Null
NewCtrl1 = Null
NewCtrl2 = Null
NewCtrl3 = Null
NewCtrl4 = Null

End Sub
 
S

Stefan Blom

You can place the macro in a template that you copy into each user's Startup
folder; that way, it will run properly.
 

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