custom commandbars

  • Thread starter Thread starter Wes Peters
  • Start date Start date
W

Wes Peters

I'm wanting to programatically iterate through a specific custom command
bars collection but I can't seem to come up with the correct syntax. Is
this even do-able? Thanks.

Wes
 
Hi,


I am not sure I understand your question, if we start with a syntax
like:


? Application.CommandBars(Application.CommandBars.Count).Name
Online Meeting


? Application.CommandBars("Database").Controls("Print Preview").Id
109


can you supply more details.

You can try to explore the Office CommandBar model through the browser (F2).
Books like Access xxxx Developers Handbook can be useful too. There is
probable some articles about that common Office component, on line, at MSDN.


Hoping it may help,
Vanderghast, Access MVP
 
I'm creating a custom command bar and I want to be able to programatically
get the names of the controls on it without knowing anything but the name of
the command bar. I then want to store the names in a table so I can later
enable/disable them based on a user's login.

I'm assuming that it starts something like:

For each ctrl in Application.CommandBars("Custom")

but I can't get that to work and also I need to check to see if a control is
a submenu. I'm guessing that I can do that through some kind of "type"
function.

Thanks for the reply,
Wes
 
Hi,



Dim ctrl As CommandBarControl
For Each ctrl In Application.CommandBars("Database").Controls
Debug.Print ctrl.Caption
Next ctrl




CommandBarControl have a Type property, that returns a value from the
msoControlType enumeration, but it is the Type property of the CommandBar
(msoBatType enumeration) that you should check, to differentiate between
menu, popup and toolbar.




Hoping it may help,
Vanderghast, Access MVP
 
Thanks for the help. I had to add a reference to the Office Object Library.
I think with what you've spelled out I can get there.
Wes
 

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

Back
Top