PC Review


Reply
Thread Tools Rate Thread

Disable all toolbars apart from custom toobar

 
 
Lisa
Guest
Posts: n/a
 
      23rd Jan 2008
Hi
I am using the following to disable all command bars when opening up my
worksheet within the Private Sub Workbook_Open()

Dim oCB As CommandBar
For Each oCB In Application.CommandBars
oCB.Enabled = False
Next oCB
End Sub

And setting it to True when I close the workbook within Private Sub
Workbook_BeforeClose(Cancel As Boolean).

I then wanted to enable my custom toolbar when all the others are disabled,
but I get an error. So to get around this, I used

Application.CommandBars(" comand bar name ").Enabled = True/False to switch
off and switch back on what I wanted

The problem is, I also use SaveCopyAs to give the worksheets a unique name
when they are saved. When they close, the beforeclose event kicks in and my
original workbook remains there with all toolbars visible.

Can anyone help?





 
Reply With Quote
 
 
 
 
Ron de Bruin
Guest
Posts: n/a
 
      23rd Jan 2008
Hi Lisa

From
http://www.rondebruin.nl/menuid.htm

You can do

Sub Disable_Command_Bars_2()
'This will disable all BuiltIn Command bars
Dim Cbar As CommandBar
For Each Cbar In Application.CommandBars
If Cbar.BuiltIn = True Then
Cbar.Enabled = False
End If
Next
End Sub

Sub Enable_Command_Bars_2()
'This will Enable all BuiltIn Command bars
Dim Cbar As CommandBar
For Each Cbar In Application.CommandBars
If Cbar.BuiltIn = True Then
Cbar.Enabled = True
End If
Next
End Sub

>> The problem is, I also use SaveCopyAs to give the worksheets a unique name

You can set
Application.EnableEvents = False to disable the events
Set it to true when the code is ready



--

Regards Ron de Bruin
http://www.rondebruin.nl/tips.htm


"Lisa" <(E-Mail Removed)> wrote in message news:41803033-2F93-4FA9-81A1-(E-Mail Removed)...
> Hi
> I am using the following to disable all command bars when opening up my
> worksheet within the Private Sub Workbook_Open()
>
> Dim oCB As CommandBar
> For Each oCB In Application.CommandBars
> oCB.Enabled = False
> Next oCB
> End Sub
>
> And setting it to True when I close the workbook within Private Sub
> Workbook_BeforeClose(Cancel As Boolean).
>
> I then wanted to enable my custom toolbar when all the others are disabled,
> but I get an error. So to get around this, I used
>
> Application.CommandBars(" comand bar name ").Enabled = True/False to switch
> off and switch back on what I wanted
>
> The problem is, I also use SaveCopyAs to give the worksheets a unique name
> when they are saved. When they close, the beforeclose event kicks in and my
> original workbook remains there with all toolbars visible.
>
> Can anyone help?
>
>
>
>
>

 
Reply With Quote
 
Lisa
Guest
Posts: n/a
 
      23rd Jan 2008
Thanks very much, will check it out

"Ron de Bruin" wrote:

> Hi Lisa
>
> From
> http://www.rondebruin.nl/menuid.htm
>
> You can do
>
> Sub Disable_Command_Bars_2()
> 'This will disable all BuiltIn Command bars
> Dim Cbar As CommandBar
> For Each Cbar In Application.CommandBars
> If Cbar.BuiltIn = True Then
> Cbar.Enabled = False
> End If
> Next
> End Sub
>
> Sub Enable_Command_Bars_2()
> 'This will Enable all BuiltIn Command bars
> Dim Cbar As CommandBar
> For Each Cbar In Application.CommandBars
> If Cbar.BuiltIn = True Then
> Cbar.Enabled = True
> End If
> Next
> End Sub
>
> >> The problem is, I also use SaveCopyAs to give the worksheets a unique name

> You can set
> Application.EnableEvents = False to disable the events
> Set it to true when the code is ready
>
>
>
> --
>
> Regards Ron de Bruin
> http://www.rondebruin.nl/tips.htm
>
>
> "Lisa" <(E-Mail Removed)> wrote in message news:41803033-2F93-4FA9-81A1-(E-Mail Removed)...
> > Hi
> > I am using the following to disable all command bars when opening up my
> > worksheet within the Private Sub Workbook_Open()
> >
> > Dim oCB As CommandBar
> > For Each oCB In Application.CommandBars
> > oCB.Enabled = False
> > Next oCB
> > End Sub
> >
> > And setting it to True when I close the workbook within Private Sub
> > Workbook_BeforeClose(Cancel As Boolean).
> >
> > I then wanted to enable my custom toolbar when all the others are disabled,
> > but I get an error. So to get around this, I used
> >
> > Application.CommandBars(" comand bar name ").Enabled = True/False to switch
> > off and switch back on what I wanted
> >
> > The problem is, I also use SaveCopyAs to give the worksheets a unique name
> > when they are saved. When they close, the beforeclose event kicks in and my
> > original workbook remains there with all toolbars visible.
> >
> > Can anyone help?
> >
> >
> >
> >
> >

>

 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
How to retain custom toobar in Powerpoint 2003 larrys3255 Microsoft Powerpoint 0 5th Jun 2009 10:55 PM
How do I export a custom toobar? Donald Microsoft Outlook Discussion 1 9th May 2008 05:52 PM
Lose custom toobar settings MikeF Microsoft Excel Misc 0 7th Feb 2008 02:52 PM
Disable custom autotext toolbars before sending to clients =?Utf-8?B?amVubmlmZXI3MjQwMQ==?= Microsoft Word Document Management 1 1st Mar 2006 11:28 PM
Adding custom faces-icons to toobar buttons. MarkHG Microsoft Excel Programming 7 9th Feb 2005 11:14 AM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 07:57 PM.