Sharing a macro in a Referenced template

A

Alder

I've created a custom CommandBar that I want to share with my workgroup. The
CommandBar is stored in a template which all users load globally from the
LAN during Word startup. As expected, this template shows up with a tick
mark in the Templates and AddIns window. Each CommandBar button runs a
macro from a second template, named SHAREDLIBRARY.DOT, also stored on the
LAN. The macros in SHAREDLIBRARY.DOT use the Documents.Add statement to
create new documents from other templates stored on the LAN.

The SHAREDLIBRARY.DOT template is not loaded globally, but is explicitly
Referenced from the CommandBar template and the document templates. When I
start Word, the SHAREDLIBRARY.DOT template appears in the Templates and
AddIns window, but is unchecked. So far, so good. Once I click on a
CommandBar button and create a new document, the SHAREDLIBRARY.DOT is
checked in the Templates and AddIns window.

The trouble is other users receive an error from Word when they click on a
CommandBar button. The error reported is that Word cannot find the template
or that a macro security setting is blocking access. The SHAREDLIBRARY.DOT
template remains unchecked in their Templates and AddIns window. If the
user then checks the SHAREDLIBRARY.DOT in their Templates and AddIns window,
the CommandBar works as it should.

Can this be corrected?

Thanks for reading,

Alder
 
W

Word Heretic

G'day "Alder" <[email protected]>,

instead of that explicitly referenced template I'd use a global
template, kept in the startup drawer of Word.


Alder said:
I've created a custom CommandBar that I want to share with my workgroup. The
CommandBar is stored in a template which all users load globally from the
LAN during Word startup. As expected, this template shows up with a tick
mark in the Templates and AddIns window. Each CommandBar button runs a
macro from a second template, named SHAREDLIBRARY.DOT, also stored on the
LAN. The macros in SHAREDLIBRARY.DOT use the Documents.Add statement to
create new documents from other templates stored on the LAN.

The SHAREDLIBRARY.DOT template is not loaded globally, but is explicitly
Referenced from the CommandBar template and the document templates. When I
start Word, the SHAREDLIBRARY.DOT template appears in the Templates and
AddIns window, but is unchecked. So far, so good. Once I click on a
CommandBar button and create a new document, the SHAREDLIBRARY.DOT is
checked in the Templates and AddIns window.

The trouble is other users receive an error from Word when they click on a
CommandBar button. The error reported is that Word cannot find the template
or that a macro security setting is blocking access. The SHAREDLIBRARY.DOT
template remains unchecked in their Templates and AddIns window. If the
user then checks the SHAREDLIBRARY.DOT in their Templates and AddIns window,
the CommandBar works as it should.

Can this be corrected?

Thanks for reading,

Alder

Steve Hudson

Word Heretic, Sydney, Australia
Tricky stuff with Word or words for you.
Email (e-mail address removed)
Products http://www.geocities.com/word_heretic/products.html

Replies offlist may require payment.
 
A

Alder

Thanks, Heretic.

I came to pretty much the same conclusion since I posted. I'm still
struggling with References and global templates, though. Maybe you can
help?

Can you explain, when I have a template open for editing, the macros
contained in its standard modules are not visible from the pick list one
opens to select Exit macros on a formfield? If I deselect the global
templates I have loaded, the local macros reappear! Shuoldn't I be able to
select from the _combined_ list of local and global macros???

Signed,

Perplexed
 
W

Word Heretic

G'day "Alder" <[email protected]>,

Yes you should. Make sure your module, project and routine names are
unique.


Alder said:
Thanks, Heretic.

I came to pretty much the same conclusion since I posted. I'm still
struggling with References and global templates, though. Maybe you can
help?

Can you explain, when I have a template open for editing, the macros
contained in its standard modules are not visible from the pick list one
opens to select Exit macros on a formfield? If I deselect the global
templates I have loaded, the local macros reappear! Shuoldn't I be able to
select from the _combined_ list of local and global macros???

Signed,

Perplexed

Steve Hudson

Word Heretic, Sydney, Australia
Tricky stuff with Word or words for you.
Email (e-mail address removed)
Products http://www.geocities.com/word_heretic/products.html

Replies offlist may require payment.
 
A

Alder

Thanks again, Heretic.

I've used unique project names in my global templates, though at the module
level I've tended to use common names like "modAuto" and "modMain" to help
myself find stuff.

One reason I had originally changed SHAREDLIBRARY.DOT from a global template
loaded at startup to one which was merely referenced by my document
templates, was that it contained a CommandBar that didn't behave itself (or
at least its trainer was inept). I wanted to have the CommandBar display
when users started Word, but it tended to appear twice.

Now that I've gone back to loading SHAREDLIBRARY.DOT at startup, the
CommandBar issue has returned. It seems the template is loaded twice
because it's in the list of loaded Templates and AddIns a second time. Any
idea why this happens?

Thanks,

Alder
 
W

Word Heretic

G'day "Alder" <[email protected]>,

1. ensure it is not a global

2. kill all add-in references to it

3. make it a global

4. ensure it doesnt reference itself (tricky, but possible)

Does the prob still exist? Also, do you have any code that adds to the
add-ins?

Your 'double-command bar', this tends to happen when you have autoexec
code to mod the toolbar or display it. I merely define the toolbar in
the GUI with context set to my template, then save the template and
make it read only. When you move or otherwise mod the toolbar, the
customization is stored in normal and your template remains inviolate.

So, maybe you need to rename normal.dot to remove spurious references
to your toolbar setup.

These spurious references can also be hidden inside your other
templates if you modded that toolbar whilst the context was left on
the other templates. In severe situations I have rebuilt the main
template, renamed its toolbar whilst rebuilding it and saved that so
that all spurious references to the old toolbar cannot match up to the
new one. This trick has worked well for me.




Alder said:
Thanks again, Heretic.

I've used unique project names in my global templates, though at the module
level I've tended to use common names like "modAuto" and "modMain" to help
myself find stuff.

One reason I had originally changed SHAREDLIBRARY.DOT from a global template
loaded at startup to one which was merely referenced by my document
templates, was that it contained a CommandBar that didn't behave itself (or
at least its trainer was inept). I wanted to have the CommandBar display
when users started Word, but it tended to appear twice.

Now that I've gone back to loading SHAREDLIBRARY.DOT at startup, the
CommandBar issue has returned. It seems the template is loaded twice
because it's in the list of loaded Templates and AddIns a second time. Any
idea why this happens?

Thanks,

Alder

Steve Hudson

Word Heretic, Sydney, Australia
Tricky stuff with Word or words for you.
Email (e-mail address removed)
Products http://www.geocities.com/word_heretic/products.html

Replies offlist may require payment.
 

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