Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 6
Default Disable Commandbars

I have a VBA program that was written using Excel 2000 and recently we
have installed it on XP machines with Excel 2003.

Everything works fine except I cannot prevent the user from clicking
on the menu bar and getting the option to show built-in menu's

My program creates its own Menu and toolbar and I don't want the user
to be able to activate any other command bars.
In Excel 2000 I used the code

" Application.CommandBars("toolbar list").Enabled = False"

and that worked great for Excel 2000 and previous versions but it does
not work for Excel 2003.
I searched Microsoft and Excel help and all I can find is how to
prevent a toolbar from being changed.
I believe that the above code is undocumented and I found it in this
forum 3 or 4 years ago.

Any help will be appreciated.
Merlyn
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 811
Default Disable Commandbars

Hi Merlyn,

There was a new property added to the CommandBars object in Excel 2002
that allows you to prevent this. To disable customization of command bars
you would use:

CommandBars.DisableCustomize = True

and to enable customization you would use:

CommandBars.DisableCustomize = False

If you application still needs to run under Excel 2000, you'll have to use
late binding and a version check to run this or Excel 2000 will give you an
error. The code to do this would look like the following:

Dim objCBars As Object
Set objCBars = Application.CommandBars
If Val(Application.Version) = 10 Then
objCBars.DisableCustomize = True
End If

--
Rob Bovey, MCSE, MCSD, Excel MVP
Application Professionals
http://www.appspro.com/

* Please post all replies to this newsgroup *
* I delete all unsolicited e-mail responses *


wrote in message
...
I have a VBA program that was written using Excel 2000 and recently we
have installed it on XP machines with Excel 2003.

Everything works fine except I cannot prevent the user from clicking
on the menu bar and getting the option to show built-in menu's

My program creates its own Menu and toolbar and I don't want the user
to be able to activate any other command bars.
In Excel 2000 I used the code

" Application.CommandBars("toolbar list").Enabled = False"

and that worked great for Excel 2000 and previous versions but it does
not work for Excel 2003.
I searched Microsoft and Excel help and all I can find is how to
prevent a toolbar from being changed.
I believe that the above code is undocumented and I found it in this
forum 3 or 4 years ago.

Any help will be appreciated.
Merlyn



Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
Excel CommandBars Daniel Utsch[_2_] Excel Discussion (Misc queries) 3 December 14th 08 07:17 PM
How to attach commandbars with VBA Carsten[_2_] Excel Programming 1 December 9th 03 12:55 PM
CommandBars defj Excel Programming 2 November 16th 03 12:57 AM
Built in Commandbars Dave Martin Excel Programming 2 August 31st 03 03:47 AM
Built In CommandBars Sander Lablans Excel Programming 0 August 1st 03 11:59 AM


All times are GMT +1. The time now is 09:39 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"