Template add-in unchecks when Word quits

M

Michael Chang

Hi,

I have a customised toolbar containing macros which I use to edit several
templates. I loaded the template containing the toolbar as an add-in so that
I can use it on the other templates.

My problem is that every time I quit and return to Word I have to go into
Templates and Add-ins to tick the checkbox in order display the toolbar. Is
there a way of keeping loaded add-ins active? Or is there a way to code the
templates which need the toolbar, so that when the templates are launched
the add-in box gets checked? I'm trying to reduce the number of steps my
users have to go through before they can use the toolbar and templates.

Thanks,
Michael
 
S

Stefan Blom

Put the template in the Startup folder, so that Word loads it
automatically on startup. You can tell which folder is
the Startup folder for Word by looking at the File locations tab of
Tools>Options. Note that you may need to select the Startup entry,
press the Modify button and then click the arrow next to the Look in
box in order to see the full path of the Startup folder. When you are
done, click Cancel (to exit the Modify Location dialog box) and then
Close (to leave the Options dialog box).
 
M

Michael Chang

Thanks Stefan. I was hoping that I wouldn't have to have the toolbar
template open because the users are working on other documents and they will
want to close the toolbar template document. I guess it's only a single
mouse click but I think they'll find it iritating. Also the toolbar isn't
used constantly so it would be annoying to have the toolbar template
document open everytime Word is launched.

If there isn't a more elegant solution I guess I will have to put all the
macros associated with the customised toolbar into each of the 6 templates
which need it. I'm not entirely happy with this because if there are any
changes to the macros or the toolbar I would have to do everything 6 times.
 
C

Chad DeMeyer

Michael,

You can load the add-in programmatically from the templates in AutoNew and
AutoOpen macros.

Dim oAddIn As AddIn, bListed As Boolean
For Each oAddIn In AddIns
If oAddIn.Name = "my addin.dot" Then
bListed = True
Exit For
End If
Next oAddIn
If bListed Then
AddIns("my addin.dot").Installed = True
Else
AddIns.Add FileName:="C:\my path\my addin.dot", Install:=True
End If

Then you unload the add-in in an AutoClose macro:

AddIns("my addin.dot").Installed = False

Regards,
Chad
 
M

Michael Chang

Thanks for your help Chad.

I am getting the following error: "The requested member of the collection
does not exist". The debugger highlights line 9: AddIns("my
addin.dot").Installed = True.

Am I correct in thinking that this is saying that my addin.dot does not
exist? But the code checked for my addin.dot in the For loop and should only
get to line 9 if my addin.dot exists and bListed = True.

The code works fine if the add-in is not loaded ie. when I remove it from
the listing, the code will load and install the add-in and continue with the
rest of the macro.

Regards,
Michael
 

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