Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Westi on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Removing ToolBars

Status
Not open for further replies.

Ogi

Technical User
Nov 9, 2001
896
GB
Hi,

How can I remove the Standard Toolbar within a VB Macro.

Sorry for my daft question but I know VB but not VBA, also, this is from within Word/Excel and Project????

Cheers,
Carl.
 
Hi,

Fixed it !!!!!

Dim cmdbar As CommandBar

For Each cmdbar in CommandBars
If cmdbar.Name = "Standard" Then
cmdBar.Visible = False
End if
Next cmdbar


Cheers for looking!
 
Hi Ogi,

Just recorded a macro of removing mine from Excel:

Code:
    Application.CommandBars("Standard").Visible = False

Then tried it in Word:

Code:
    CommandBars("Standard").Visible = False

Finally tried it in Project:

Code:
    CommandBars("Standard").Visible = False

Seems pretty consistent!

Enjoy,
Tony
 
Hi
Just a little addition here. Depending on your objective here use
Code:
CommandBars("standard").Enabled = False
rather than the Visible property

The main difference is that if you set the visible property to false it's easy to get the toolbar back using the normal menu methods. If the commandbar is 'disabled' it isn't as straight forward to get it back ie it isn't visible from View>Toolbars.

Haven't got Project to check there!

;-)

If a man says something and there are no women there to hear him, is he still wrong? [ponder]
 
Hi,

Thanks guys!

I've altered the way I do it now:-

CommandBars("Standard").Enabled = False
CommandBars("Standard").Visible = False

This way, it's quicker than my way and it gives that bit more security!

Now if only I could disable Ctrl+O key presses!

Cheers,
Carl.
 
Hi
One small point - you only need to use one of the above lines of code, depending on your requirements.

As for disabling CTRL+O the only method I'm aware of is to record a macro and asssign that key combination to it. Don't put anything into the macro so that when that key combination is used nothing happens.

There is a down side to using this method for which I don't know the solution. It means that CTRL+O is unavailable as long as your workbook is open!

;-)

If a man says something and there are no women there to hear him, is he still wrong? [ponder]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top