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 / August 2007

Tip: Looking for answers? Try searching our database.

Finding user-defined toobars

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
EllenM - 14 Aug 2007 18:32 GMT
Hello,

I have a very simple question pertaining to user-defined toolbars. So far, I
know how to turn on and off the visibility of toobars  (either docked or
floating palettes)  Example below:

CommandBars("GRPT_Toolbar").Visible = True

The dilemma I face is trying to write a script to first test for the
existence of a user-defined toobar before I try to reference it in other
places of the automacro I am writing.

In case you are wondering, I need this because I have an embedded automacro
in a template that references these user-defined toobars. As such, there is
the potential of someone receiving a document from which my template is
based, but not having the toobar on his/her machine. Of course, they will get
an error since the script is referencing something that is not there. I know
the bookmark object has such properties for testing for the existence of
bookmarks. Is there something similar for toobars? If not, is there some sort
of exception hander I could use to filter the error?

Thanks
Russ - 14 Aug 2007 18:56 GMT
Ellen,
This example was found when I entered commandbar into Word VBA Help and
selected commandbar object.

foundFlag = False
For Each cb In CommandBars
   If cb.Name = "Forms" Then
       cb.Protection = msoBarNoChangeDock
       cb.Visible = True
       foundFlag = True
   End If
Next cb
If Not foundFlag Then
   MsgBox "The collection does not contain a Forms command bar."
End If
'
In the first "If",  I would also use 'Exit For' to stop iterating, once the
name we want is found.

> Hello,
>
[quoted text clipped - 18 lines]
>
> Thanks

Signature

Russ

drsmN0SPAMikleAThotmailD0Tcom.INVALID

EllenM - 15 Aug 2007 11:48 GMT
Thanks so much, Russ.  It works!!

> Ellen,
> This example was found when I entered commandbar into Word VBA Help and
[quoted text clipped - 37 lines]
> >
> > Thanks
 
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.