Hi,

is it possible to share a toolbar to use it within multiple templates?
I've put the template with the toolbar to be shared in the office
startup folder, but i want the toolbar to appear only in specific
templates, not in everyone.

cheers, matthias

Re: Share Toolbar for multiple templates by Graham

Graham
Mon Mar 03 03:34:10 PST 2008

You could remove it to the specific templates?

--
<>>< ><<> ><<> <>>< ><<> <>>< <>><<>
Graham Mayor - Word MVP

My web site www.gmayor.com
Word MVP web site http://word.mvps.org
<>>< ><<> ><<> <>>< ><<> <>>< <>><<>


mamue wrote:
> Hi,
>
> is it possible to share a toolbar to use it within multiple templates?
> I've put the template with the toolbar to be shared in the office
> startup folder, but i want the toolbar to appear only in specific
> templates, not in everyone.
>
> cheers, matthias



Re: Share Toolbar for multiple templates by mamue

mamue
Mon Mar 03 04:17:27 PST 2008

On Mar 3, 12:34 pm, "Graham Mayor" <gma...@REMOVETHISmvps.org> wrote:
> You could remove it to the specific templates?
>
> --
> <>>< ><<> ><<> <>>< ><<> <>>< <>><<>
> Graham Mayor - Word MVP
>
> My web sitewww.gmayor.com
> Word MVP web sitehttp://word.mvps.org
> <>>< ><<> ><<> <>>< ><<> <>>< <>><<>
>
> mamue wrote:
> > Hi,
>
> > is it possible to share a toolbar to use it within multiple templates?
> > I've put the template with the toolbar to be shared in the office
> > startup folder, but i want the toolbar to appear only in specific
> > templates, not in everyone.
>
> > cheers, matthias

Sorry Graham, i didn't understand what you mean with "removing to
specific templates".

cheers, matthias

RE: Share Toolbar for multiple templates by JeanGuyMarcil

JeanGuyMarcil
Mon Mar 03 06:00:03 PST 2008

"mamue" wrote:

> Hi,
>
> is it possible to share a toolbar to use it within multiple templates?
> I've put the template with the toolbar to be shared in the office
> startup folder, but i want the toolbar to appear only in specific
> templates, not in everyone.

For this to truely work, you will need application events.
You need to detect when a document is created/opened, then you need to check
the attached template, if it belongs to your list, display the toolbar,
otherwise hide it. Then, becasue a user may work with many documents at once,
all based, maybe, on different templates, you also need to detect when the
user changes from document to document and display/hide the toolbar as
appropriate. I have done something like this in the past and I can assure you
that it is not trivial. For someone who has experience with VBA and
Application events, it is not difficult, but it does take some time as a fair
amount of code has to be written and checked.

If you are a VBA beginner, this is quite a challenge! In any case, since you
need to go through Application Events, you may want to find out about them,
start here:
http://word.mvps.org/faqs/macrosvba/AppClassEvents.htm


Re: Share Toolbar for multiple templates by mamue

mamue
Mon Mar 03 06:13:19 PST 2008

On Mar 3, 3:00 pm, Jean-Guy Marcil
<JeanGuyMar...@discussions.microsoft.com> wrote:
> "mamue" wrote:
> > Hi,
>
> > is it possible to share a toolbar to use it within multiple templates?
> > I've put the template with the toolbar to be shared in the office
> > startup folder, but i want the toolbar to appear only in specific
> > templates, not in everyone.
>
> For this to truely work, you will need application events.
> You need to detect when a document is created/opened, then you need to check
> the attached template, if it belongs to your list, display the toolbar,
> otherwise hide it. Then, becasue a user may work with many documents at once,
> all based, maybe, on different templates, you also need to detect when the
> user changes from document to document and display/hide the toolbar as
> appropriate. I have done something like this in the past and I can assure you
> that it is not trivial. For someone who has experience with VBA and
> Application events, it is not difficult, but it does take some time as a fair
> amount of code has to be written and checked.
>
> If you are a VBA beginner, this is quite a challenge! In any case, since you
> need to go through Application Events, you may want to find out about them,
> start here:
> http://word.mvps.org/faqs/macrosvba/AppClassEvents.htm

Thanks Jean-Guy, i'll check that page, altough i hope for a more
trivial way ;-)

Re: Share Toolbar for multiple templates by Graham

Graham
Mon Mar 03 06:09:53 PST 2008

Currently you have the toolbar in a global template, which by implication
will make it available to all documents. if you only want it applicable only
to certain document templates, then copy it to those templates (using the
organizer) and remove it from the global template. If buttons on the toolbar
call macros stored elsewhere, you will probably have to re-add the macro
buttons to the toolbars after you have moved them.

--
<>>< ><<> ><<> <>>< ><<> <>>< <>><<>
Graham Mayor - Word MVP

My web site www.gmayor.com
Word MVP web site http://word.mvps.org
<>>< ><<> ><<> <>>< ><<> <>>< <>><<>

mamue wrote:
> On Mar 3, 12:34 pm, "Graham Mayor" <gma...@REMOVETHISmvps.org> wrote:
>> You could remove it to the specific templates?
>>
>> --
>> <>>< ><<> ><<> <>>< ><<> <>>< <>><<>
>> Graham Mayor - Word MVP
>>
>> My web sitewww.gmayor.com
>> Word MVP web sitehttp://word.mvps.org
>> <>>< ><<> ><<> <>>< ><<> <>>< <>><<>
>>
>> mamue wrote:
>>> Hi,
>>
>>> is it possible to share a toolbar to use it within multiple
>>> templates? I've put the template with the toolbar to be shared in
>>> the office startup folder, but i want the toolbar to appear only in
>>> specific templates, not in everyone.
>>
>>> cheers, matthias
>
> Sorry Graham, i didn't understand what you mean with "removing to
> specific templates".
>
> cheers, matthias



Re: Share Toolbar for multiple templates by JeanGuyMarcil

JeanGuyMarcil
Mon Mar 03 09:05:04 PST 2008

"mamue" wrote:

>
> Thanks Jean-Guy, i'll check that page, altough i hope for a more
> trivial way ;-)
>

If you want an easy/trivial way, I believe that Graham's suggestions fits
the bill.
One minor drawback is that you will have to maintain multiple instances of
the same code.
One major drawback is that if a user works on two documents, each one being
based on two different templates, there will two instances of the toolbar on
the UI. If you have 5 different templates, you could end up with 5 instances
of the toolbar on the UI...


Re: Share Toolbar for multiple templates by Jonathan

Jonathan
Tue Mar 04 02:13:44 PST 2008


"mamue" <mamuesmailbox@googlemail.com> wrote in message
news:74aef044-7066-473d-9710-b5672c386fb9@e6g2000prf.googlegroups.com...
> Hi,
>
> is it possible to share a toolbar to use it within multiple templates?
> I've put the template with the toolbar to be shared in the office
> startup folder, but i want the toolbar to appear only in specific
> templates, not in everyone.
>
> cheers, matthias

Hi Matthias

Both Graham and Jean-Guy have given you parts of the answer, but they have
complicated things a bit.

Proceed as follows:

For each template whose documents you want to display to the toolbar, copy
the toolbar from your global template to the document template.

When you have done this, delete the toolbar from your global template.

The toolbar will now only be visible when a document based on one of those
individual templates is active. The buttons will work as normal, provided
that the global template is loaded as an add-in. The best way to do that is
for the global template to be put in the startup folder so it is loaded when
Word is started.

That really is all there is to it.

You can then if you wish customise the toolbar for each individual template,
removing buttons that aren't needed for that document type.


--
Regards
Jonathan West - Word MVP
www.intelligentdocuments.co.uk
Please reply to the newsgroup


Re: Share Toolbar for multiple templates by JeanGuyMarcil

JeanGuyMarcil
Tue Mar 04 05:16:00 PST 2008

"Jonathan West" wrote:

>
> Proceed as follows:
>
> For each template whose documents you want to display to the toolbar, copy
> the toolbar from your global template to the document template.
>
> When you have done this, delete the toolbar from your global template.
>
> The toolbar will now only be visible when a document based on one of those
> individual templates is active. The buttons will work as normal, provided
> that the global template is loaded as an add-in. The best way to do that is
> for the global template to be put in the startup folder so it is loaded when
> Word is started.
>
> That really is all there is to it.
>

Hi Jonathan,

I'll be... !!! I have tried something like this in the past and I seem to
remember that I had a problem regarding the multiple appearance of the
toolbar according to the number of active attached templates. I guess I must
have done someting different from what you outlined... Maybe my
overly-cautious nature made me name each toolbar differently... This must be
why your approach does not have this problem... All toolbars have the same
name, right? If not, why is it that even if you have 3 active attached
templates you still get only one instance of the toolbar?

Thanks... again!

Re: Share Toolbar for multiple templates by JeanGuyMarcil

JeanGuyMarcil
Tue Mar 04 07:00:04 PST 2008

"Jean-Guy Marcil" wrote:

> overly-cautious nature made me name each toolbar differently... This must be
> why your approach does not have this problem... All toolbars have the same
> name, right? If not, why is it that even if you have 3 active attached
> templates you still get only one instance of the toolbar?

Never mind... I must have gone to bed too late last night!
As long as you do not have three template in the global folder, each
document has only one attached template, so of course, only one toolbar will
be displayed at the time...

I think that I am confusing issues here becasue I had a project where I had
to use a few global templates... Hence the problem I had with the many
toolbars... I can't remember the specifics... It was a few years ago... (Or
it may have been another project where the toolbar had to be diffrent
depending on the type of document, but the client wanted only one template...
So I needed Application events to check the type of document being displayed
and modify the toolbar on the fly...)

That'll teach me to try to help somebody based on a hazy recollection!

Thanks for your input!

Re: Share Toolbar for multiple templates by Jonathan

Jonathan
Tue Mar 04 13:21:34 PST 2008


"Jean-Guy Marcil" <JeanGuyMarcil@discussions.microsoft.com> wrote in message
news:9061295B-EE15-4BA3-B802-2F4974EB9A92@microsoft.com...
> "Jean-Guy Marcil" wrote:
>
>> overly-cautious nature made me name each toolbar differently... This must
>> be
>> why your approach does not have this problem... All toolbars have the
>> same
>> name, right? If not, why is it that even if you have 3 active attached
>> templates you still get only one instance of the toolbar?
>
> Never mind... I must have gone to bed too late last night!
> As long as you do not have three template in the global folder, each
> document has only one attached template, so of course, only one toolbar
> will
> be displayed at the time...
>
> I think that I am confusing issues here becasue I had a project where I
> had
> to use a few global templates... Hence the problem I had with the many
> toolbars... I can't remember the specifics... It was a few years ago...
> (Or
> it may have been another project where the toolbar had to be diffrent
> depending on the type of document, but the client wanted only one
> template...
> So I needed Application events to check the type of document being
> displayed
> and modify the toolbar on the fly...)
>
> That'll teach me to try to help somebody based on a hazy recollection!
>
> Thanks for your input!

This is the standard way I proceed these days for my commercial templates. I
have a lot of VBA code for them, and it makes sense to have it included in
the overall project only once, and have the individual templates use the
bits they need from a customized toolbar in the document template which
calls code in the add-in.


--
Regards
Jonathan West - Word MVP
www.intelligentdocuments.co.uk
Please reply to the newsgroup


Re: Share Toolbar for multiple templates by mamue

mamue
Wed Mar 05 00:27:11 PST 2008

On Mar 4, 10:21 pm, "Jonathan West" <jw...@mvps.org> wrote:
> "Jean-Guy Marcil" <JeanGuyMar...@discussions.microsoft.com> wrote in message
>
> news:9061295B-EE15-4BA3-B802-2F4974EB9A92@microsoft.com...
>
>
>
> > "Jean-Guy Marcil" wrote:
>
> >> overly-cautious nature made me name each toolbar differently... This must
> >> be
> >> why your approach does not have this problem... All toolbars have the
> >> same
> >> name, right? If not, why is it that even if you have 3 active attached
> >> templates you still get only one instance of the toolbar?
>
> > Never mind... I must have gone to bed too late last night!
> > As long as you do not have three template in the global folder, each
> > document has only one attached template, so of course, only one toolbar
> > will
> > be displayed at the time...
>
> > I think that I am confusing issues here becasue I had a project where I
> > had
> > to use a few global templates... Hence the problem I had with the many
> > toolbars... I can't remember the specifics... It was a few years ago...
> > (Or
> > it may have been another project where the toolbar had to be diffrent
> > depending on the type of document, but the client wanted only one
> > template...
> > So I needed Application events to check the type of document being
> > displayed
> > and modify the toolbar on the fly...)
>
> > That'll teach me to try to help somebody based on a hazy recollection!
>
> > Thanks for your input!
>
> This is the standard way I proceed these days for my commercial templates. I
> have a lot of VBA code for them, and it makes sense to have it included in
> the overall project only once, and have the individual templates use the
> bits they need from a customized toolbar in the document template which
> calls code in the add-in.
>
> --
> Regards
> Jonathan West - Word MVPwww.intelligentdocuments.co.uk
> Please reply to the newsgroup

Thanks to all of you. The willingness to help in this group is
amazing. I copied the toolbar Jonathan's way. And it works ;-)