Foolproof way to add toolbar button for .dot file

R

RB Smissaert

Is there a foolproof way to make a global template file, a .dot file, add a
button to the standard Word toolbar, the one with File, Edit etc.

I have seen and tried many suggestions, such as putting the code that adds
the button in:
- an AutoOpen Sub
- an AutoExec Sub
- the Document_Open event
- Just adding the button manually and saving the .dot file
with the added button.

The last one was the only one that seemed to work, but when I altered the
location of the .dot file from the
Startup folder in C:\Program Files\ etc. to the one under Documents and
Settings it didn't work anymore.

Surely, there must be same place to put the code so it will run when the
..dot file opens/loads.

RBS
 
J

Jean-Guy Marcil

RB Smissaert was telling us:
RB Smissaert nous racontait que :
Is there a foolproof way to make a global template file, a .dot file,
add a button to the standard Word toolbar, the one with File, Edit
etc.
I have seen and tried many suggestions, such as putting the code that
adds the button in:
- an AutoOpen Sub
- an AutoExec Sub
- the Document_Open event
- Just adding the button manually and saving the .dot file
with the added button.

The last one was the only one that seemed to work, but when I altered
the location of the .dot file from the
Startup folder in C:\Program Files\ etc. to the one under Documents
and Settings it didn't work anymore.

All of the above will work.. depending on what the said button does (and its
scope/life expectancy).

Do you need the button for all documents/some/always/ etc.

By the way, as soon as you move a template away from the start-up folder, it
ceases to be a global template (or add-in). The code/custom toolbars it
contains will work only when you create documents based on that template.
Also, AutoOpen and Document_Open are the same, it is just that the former
is deprecated.
Finally, if the code that creates the button is in a Document_Open sub, it
will not get executed when creating a document based on this template. For
this, you need to use Document_New.

So, in short, without you telling us more on your purpose and environment,
it is difficult to suggest a "foolproof" way.

--
Salut!
_______________________________________
Jean-Guy Marcil - Word MVP
(e-mail address removed)
Word MVP site: http://www.word.mvps.org
 
R

RB Smissaert

OK, let me explain a bit more.
The purpose of this .dot file is to get data from an Interbase database and
put that data in the ActiveDocument.
The button on the toolbar will launch a Userform that is the interface to
get this data. This Userform will either be a login form when there is no
connection to the database yet or the actual form that sets the parameters
to get the data from Interbase.
So, I am not interested in formats etc. or base the produced document on
that
..dot file.
I suppose I could keep it simple and tell the user to run the macro that
adds
this button via Tools, Macro, Macros, but that is not very neat.

It seems .dot files are not as simple as Excel .xla files.

RBS
 

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