custom toolbar options

ishi

Board Regular
Joined
Apr 3, 2003
Messages
126
I have created my own toolbar and just placed it at the top. What i would like to do is have this hidden or disabled on open of workbook. Also i have a login form that loads on open of the workbook and when the users enter their logins (not set up yet) depening who they are can have certain buttons enabled on my toolbar. After the login process have the toolbar unhidden.

Any help much appreciated.

Thanks,

ishi
 

ishi

Board Regular
Joined
Apr 3, 2003
Messages
126
Tommygun your example has Test Menu and underneath that Test Menu Item. In my example i have another submenu after that. How can you work out the index number or caption to be able to disable some of these.

Where i havn't got any popupcontrols its possible to do it like this...
For Each ctrl In Application.CommandBars("mybar").Controls
If ctrl.Index = 1 Then
ctrl.Enabled = False
and the rest

But this won't work where there are popcontrols and can't seem to find a way to find the index or caption to enable/disable the controls.

please help.

ishi
 

Some videos you may like

Excel Facts

Repeat Last Command
Pressing F4 adds dollar signs when editing a formula. When not editing, F4 repeats last command.

TommyGun

MrExcel MVP
Joined
Dec 9, 2002
Messages
4,202
Not exactly sure what you mean? :unsure: Are you saying that you want to disable a control within a sub-menu? I do this on a daily basis and can send you a file that might get you going in the right direction.
 

ishi

Board Regular
Joined
Apr 3, 2003
Messages
126
firstly the answer is yes to your question.

For example, if you look at the worksheet menu bar in excel you can see File as the first control. When you click that it gives you further menu options underneath i.e. Print Area which then pops up another menu. Basically mine is constructed like this. The thing i want to do is say disable Set Print Area.

Hope this is better.

ishi
 

TommyGun

MrExcel MVP
Joined
Dec 9, 2002
Messages
4,202
Here's how you would do your example. Maybe it will give you the structure you need for your menu...
Code:
Application.CommandBars("Worksheet Menu Bar").Controls("File").Controls("Print Area").Controls("Set Print Area").Enabled = False
 

ishi

Board Regular
Joined
Apr 3, 2003
Messages
126

ADVERTISEMENT

That was exactly what i was looking for. If you were in the UK I would definitley buy you a beer or 2. Thanks enormously.

ishi
 

TommyGun

MrExcel MVP
Joined
Dec 9, 2002
Messages
4,202
No problem.
 

ishi

Board Regular
Joined
Apr 3, 2003
Messages
126
just one other question. Is it possible to copy over the custom toolbar onto someone else's machine if it is not created in code. The application is on a network server but the toolbar does not appear on anyone else's machine but mine.

ishi
 

Watch MrExcel Video

Forum statistics

Threads
1,108,858
Messages
5,525,236
Members
409,637
Latest member
LT TASL

This Week's Hot Topics

Top