Commandbars/toolbars location

D

dz

Does anyone know how to force the toolbars to nicely stack
on the top left?

For example, the following code does not take toolbars off
the same level and place on separate levels (regardless of
the Tools, Customize, Options setting of "Show standard
and formatting toolbars on two rows"):

For Each cbar In CommandBars
If cbar.Visible = True Then cbar.Position = msoBarTop
Next

And, sometimes the toolbars are offset to the right a bit,
not at Left 0.

Also, is there a way to order the toolbars (i.e., Menu on
top, Standard next, formatting next, etc.)?

Thanks so much.
 
S

Stephanie Krieger

Hi DZ,

No need to do manual workarounds - you were on the right
track ... RowIndex along with a few other properties will
do it ... place the following code in a template that
loads from your Word, Startup folder (make sure your
macro security is set to a level that will allow code to
run automatically on startup -- that's a max of Medium in
Word 2000 or earlier, max of High in XP or 2003) ... and
change the name of the PDF toolbar if it doesn't match
(this is the name of mine -- but it's version-specific):

Sub AutoExec()

With CommandBars("Standard")
..Visible = True
..Position = msoBarTop
..Left = 0
..RowIndex = 3
End With

With CommandBars("Formatting")
..Visible = True
..Position = msoBarTop
..RowIndex = 4
..Left = 0
End With

With CommandBars("PDFMaker 6.0")
..Visible = True
..Position = msoBarTop
..RowIndex = 4
End With

End Sub

If you want to ensure that those are the only visible
toolbars -- set the Visible property to false for any
other toolbars during the same procedure.

Also -- if a user moves a toolbar between Formatting and
PDF, the code above might not make the PDF toolbar flush
left. To correct for this, if you have the AutoExec macro
hide other toolbars ... check the value of the Left
property for the PDF toolbar when it's in the position
you want (just do this once when setting up your code),
and you can add that value into the above code in the PDF
toolbar's With\End With loop ... i.e.,

..Left = 673

(If you aren't accustomed to retrieving that kind of
information from VBA -- there are a few ways ... I
personally like to throw a quick message box for myself.
Create this single-line macro:

msgbox CommandBars("PDFMaker 6.0").Left

and when you run that, a message box will show you the
value of that property.)

If the above doesn't do the whole trick for you -- feel
free to email me. I probably won't be back on newsgroups
this week.

Best,
Stephanie

MODD_2003 at msn dot com
 
S

Stephanie Krieger

Hi DZ ...

Answered your questions in a response to your other post
above.

Stephanie
 
S

Stephanie Krieger

Making myself dizzy with this post ... sorry -- because
you had 2 separate, related posts one above each
other...long day ;) I just wanted to add that you have to
set the Left property of the individual commandbar object
to 0 -- as in the code I gave you in the 2:33PM post --
if you want to ensure that the toolbar starts on the left
edge of the top dock area.

Also -- I didn't answer one of your questions before --
you can stack them with the RowIndex property. In the
same-referenced code I gave you, add another With\End
With loop for CommandBars("Menu Bar") and set the
RowIndex to 2. Same principle for other commandbars you
choose to force as visible and want to stack.


Best,
Stephanie
 
D

dz

Thank you so much! I can't wait to try it out.

One more question, is there a way to programically set the
Tools, Customize,Options "Show standard and formatting on
two separate rows"?
 
S

Stephanie Krieger

You're very welcome! I hope it does the trick.

Actually, the toggle command to set Standard & Formatting
on two rows is the one Tools, Customize feature I haven't
run across a property for - but I suspect that's because
setting the RowIndex property will specify whether
they're on the same or separate rows.

Best,
Stephanie
 

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