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