Ureader.com  
Microsoft software help and Community
   home   |   control panel login   |   archive   |  
 
Word
application.errors
conversions
docmanagement
drawing.graphics
formatting.longdocs
international
internet.assistant
mail
mailmerge.fields
menustoolbars
newusers
numbering
oleinterop
pagelayout
printingfonts
setup.networking
spelling.grammar
tables
vba.addins
vba.beginners
vba.customization
vba.general
vba.userforms
web.authoring
word6-7macros
word97vba
  
 
date: Wed, 06 Aug 2008 11:39:48 -0500,    group: microsoft.public.word.customization.menustoolbars        back       


Can I control a toolsbar's appearence through programming?   
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
date: Wed, 06 Aug 2008 11:39:48 -0500   author:   Marten

Re: Can I control a toolsbar's appearence through programming?   
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

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



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
date: Thu, 7 Aug 2008 16:13:14 +0300   author:   Graham Mayor

Re: Can I control a toolsbar's appearence through programming?   
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"
 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.
date: Thu, 07 Aug 2008 09:44:13 -0500   author:   Marten

Google
 
Web ureader.com


    COPYRIGHT 2007, YARDI TECHNOLOGY LIMITED, ALL RIGHT RESERVE  |   contact us