Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
DiscussionsAccessExcelInfoPathOutlookPowerPointPublisherWord
DirectoryUser Groups
Related Topics
Outlook ExpressInternet ExplorerWindowsMS Server ProductsMore Topics ...

MS Office Forum / Word / Programming / May 2006

Tip: Looking for answers? Try searching our database.

Displaying selected Toolbars

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Rosellina - 19 May 2006 09:53 GMT
I am fairly new at VBA, any help is greatly appreciated.
I have set up a template - for all documents based on this template ONLY a
custom toolbar should be displayed.  I can do this the "long way round" by
using the following in an AutoNew macro:
  CommandBars("MyToolbar").Visible = True
  CommandBars("Task Pane").Visible = False
  CommandBars("Formatting").Visible = False
  CommandBars("Standard").Visible = False
  etc etc.
As the template will be used by various users, my problem is, how do I
return Word defaults to what they were before using my template.  At present
I am using the following commands in an AutoClose macro, to restore commonly
used toolbars like Standard and Formatting:
   CommandBars("Formatting").Visible = True
   CommandBars("Standard").Visible = True
but of course different users have different toolbars (Drawing etc.)
normally displayed.  Can any body help me with this problem?  I have tried
using the Customization Context command, but I don't seem to get it right.
Thanks for your help
Helmut Weber - 19 May 2006 13:21 GMT
Hi Rosellina,

well, in Word 2003 there are 142 commandbars.
You may check, which commandbars are visible,

like, with an empty doc for testing:

Dim oCmd As CommandBar
For Each oCmd In ActiveDocument.CommandBars
  If oCmd.Visible = True Then
     Selection.TypeText oCmd.Index & " " & oCmd.Name
     Selection.TypeText vbCr
  End If
Next

Then, I don't think there is another way,
you have to store the values you get somewhere,
e.g. in a documentvariable,
or in some documentvariables,
and restore the commandbars before closing.

Signature

Greetings from Bavaria, Germany

Helmut Weber, MVP WordVBA

Win XP, Office 2003
"red.sys" & Chr$(64) & "t-online.de"

Rosellina - 19 May 2006 13:41 GMT
Thank you Helmut, this is great.  I will try and work on this, to feed the
commandbars no.s to my macros, so that I can make them visible again at the
end of the Word session (AutoClose in my template file).

I should have said, but I work with Word 2002.

Thanks once again for the prompt and excellent help.

> Hi Rosellina,
>
[quoted text clipped - 16 lines]
> or in some documentvariables,
> and restore the commandbars before closing.
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.