How to find a specified CommandBar?

H

Hurry Wood

I add a "Custom" CommandBar to MS Word as permanence. I want to find and get
that CommandBar when MS Word startup next time. I mean I dont want to add
that CommandBar every time MS Word startup. But I cannt find any method just
as "xxx.Find", how to find the specified CommandBar?

Thanks :)
 
T

T-Man

Hey Hurry,

Try something like this:

Dim MyBar As CommandBar

MyBar = Application.CommandBars("[Replace brackets here with the name of
your toolbar]")

-- MyBar will now reference your toolbar

or this


Dim cbBar As CommandBar

For Each cbBar in Application.CommandBars
If StrComp(cbBar.Name, "[Replace brackets here with the name of your
toolbar]", vbTextCompare)=0 then
Exit For
End If
Next cbBar

-- cbBar will now reference your toolbar
 

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