(Msg. 1) Posted: Wed Aug 06, 2008 11:39 am
Post subject: Can I control a toolsbar's appearence through programming? Archived from groups: microsoft>public>word>customization>menustoolbars (more info?)
I'm starting to get a bit fancier with my macro, etc programming. I
would like to know if I can adjust the content of a toolbar during the
session.
My situation: We have several offices and several divisions in each.
(All users are currently running Word 2003.) Each combination has
it's own letterhead template. Sometimes an office needs to write
correspondence for another. I'd like to make two pick tools that
contain cities and division and put them on the toolbar. Similar in
appearance to the Font and Font Size pickers. The user sets the city
and division (bonus would be if the last settings are remembered) and
then clicks on a single Letterhead button. The appropriate letterhead
template is opened.
I've made a toolbar that has a button that can call a template. No
problem there. I've even figured out the logic to open the templates
through inputs in a dialog box. But I'd like to use the pick tools if
possible.
Can anyone tell me if this is possible and give me some pointers on
the pick tools?
(Msg. 2) Posted: Thu Aug 07, 2008 4:13 pm
Post subject: Re: Can I control a toolsbar's appearence through programming? [Login to view extended thread Info.] Archived from groups: per prev. post (more info?)
You could add a custom toolbar to the template with a New Menu command added
to it. Into that New Menu (rename it to whatever) add the autotext entries
that represent the items that you want to include with your template. Ensure
that the autotexts are saved in the letter template.
OR
You could add the templates to toolbar New Menu item, but given that you
would have had to open a document basd on the template to get that far it
seems rather pointless.
OR
You could populate the letterhead with the correct information from the
outset using either vba or conditional includetext fields based on some
local or user input criteria.
--
<>>< ><<> ><<> <>>< ><<> <>>< <>><<>
Graham Mayor - Word MVP
Marten wrote:
> I'm starting to get a bit fancier with my macro, etc programming. I
> would like to know if I can adjust the content of a toolbar during the
> session.
>
> My situation: We have several offices and several divisions in each.
> (All users are currently running Word 2003.) Each combination has
> it's own letterhead template. Sometimes an office needs to write
> correspondence for another. I'd like to make two pick tools that
> contain cities and division and put them on the toolbar. Similar in
> appearance to the Font and Font Size pickers. The user sets the city
> and division (bonus would be if the last settings are remembered) and
> then clicks on a single Letterhead button. The appropriate letterhead
> template is opened.
>
> I've made a toolbar that has a button that can call a template. No
> problem there. I've even figured out the logic to open the templates
> through inputs in a dialog box. But I'd like to use the pick tools if
> possible.
>
> Can anyone tell me if this is possible and give me some pointers on
> the pick tools?
>
> Marten
(Msg. 3) Posted: Thu Aug 07, 2008 4:13 pm
Post subject: Re: Can I control a toolsbar's appearence through programming? [Login to view extended thread Info.] Archived from groups: per prev. post (more info?)
Thanks for the reply.
I had been working on a single file version of our letterheads that is
similar to your option #3. When that template is opened, there would
be a dialog box with radio buttons for options. Based on the options I
would move to bookmarks and insert the appropriate next. That's still
a consideration. The nice part would be that it is 1 file to upate
instead of the 27 letterhead templates I have now. I've had to shelve
that project for a while.
Since my posting, I discovered the CommandBars object and the
following code. What I need to do is figure out the value of each
combo box and use them together to determine the which template to
open when another button on the toolbar is pressed. I'm trying to see
if I can create a couple of public variables.
ie The button's action would be a routine with IFs
IF Combo1 = x and Combo2 = y then open TemplateXY
Marten
Sub AddMyCombo()
Dim comboCity As CommandBarComboBox
Set comboCity = CommandBars("Custom
1").Controls.Add(msoControlComboBox)
With comboCity
.AddItem "Toronto", 1
.AddItem "Edmonton", 2
.AddItem "Vancouver", 3
.DropDownLines = 3
.DropDownWidth = 75
.ListIndex = 0
.Tag = "City"
.OnAction = "MySub"
End With
Dim comboDiv As CommandBarComboBox
Set comboDiv = CommandBars("Custom
1").Controls.Add(msoControlComboBox)
With comboDiv
.AddItem "Retail", 1
.AddItem "Wholesale", 2
.AddItem "Internet", 3
.DropDownLines = 3
.DropDownWidth = 75
.ListIndex = 0
.Tag = "Division"
.OnAction = "MySub"
End With
End Sub
Sub MySub()
With CommandBars.ActionControl
MsgBox .Tag & " = " & .List(.ListIndex)
End With
End Sub
On Thu, 7 Aug 2008 16:13:14 +0300, "Graham Mayor"
<gmayor.RemoveThis@REMOVETHISmvps.org> wrote:
>You could add a custom toolbar to the template with a New Menu command added
>to it. Into that New Menu (rename it to whatever) add the autotext entries
>that represent the items that you want to include with your template. Ensure
>that the autotexts are saved in the letter template.
>
>OR
>
>You could add the templates to toolbar New Menu item, but given that you
>would have had to open a document basd on the template to get that far it
>seems rather pointless.
>
>OR
>
>You could populate the letterhead with the correct information from the
>outset using either vba or conditional includetext fields based on some
>local or user input criteria.
All times are: Eastern Time (US & Canada) (change)
Page 1 of 1
You can post new topics in this forum You can reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum