LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #7   Report Post  
Posted to microsoft.public.excel.programming
GS GS is offline
external usenet poster
 
Posts: 364
Default Restoring ToolBars/Commandbars

This sounds like you you want to "take over" Excel so only your toolbar/menus
are used while the project is open. If so then...

You need to store a list of all the commandbars you want to hide, then
iterate the list to restore them before close. If you could just do the
visible bars then that's a simple task. If you need to restrict user access
to other commandbars then you need to "disable" the various paths one could
take to get at them. This is probably better than having to iterate the
commandbars collection for every bar, which could take fairly long. If
something goes wrong in the process, ..then what?

Your code sample disables all of them, which suggests your project provides
all the menus, popups, etc that it uses. That's admirable, but it has its
challenges in making it all happen smoothly, and without any hitches.

In any case, you need a workspace management strategy for handling this,
-something like 'StoreSettings()' for starting up and 'RestoreSettings()' for
shutting down. Just call them appropriately from code in "ThisWorkbook". This
will, at the very least, give you a start for what changes you make and how
they need to be restored.

If the settings are only for the current session, I suggest using a hidden
sheet to store the info would be the easiest way. A simple format would be to
list the settings you want to manipulate in column1 of a 3-column range. In
the other two, use one for existing settings and the other for your settings.
Then write code to step through the list on startup, that collects and writes
the values. Then go through it to read and apply your values. This leaves one
more iteration on close to read and restore the original settings.

Have another area(s) on the sheet to store the commandbar names, and their
respective values. I would put them in separate lists according to the
setting. (.Visible list, .Enabled list...) That way you can process them more
easily in your code, ..if not more organized. This could be a single cell for
each list, containing the names separated by commas, named BarsVisible,
BarsEnabled, and so on. (just a suggestion using the setting in the name)

If you need some good reference material for this, here's some books that
are worth more than their weight in gold:

Excel xxxx Power Programming with VBA by John Walkenbach is a good one to
start with.

Excel xxxx VBA: Programmer's Reference by Stephen Bullen, Rob Bovey, John
Green, et al (If you still aren't full)
and by the same authors...
Professional Excel Development (if you're really looking to "get into it")

Amazon.com has them all. Good luck!
GS
 
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
Restoring izmn19 Excel Discussion (Misc queries) 2 April 13th 08 08:17 PM
Removing/restoring toolbars peter.thompson[_69_] Excel Programming 2 January 31st 06 09:03 PM
Removing and Restoring Excel toolbars peter.thompson[_31_] Excel Programming 3 January 7th 06 09:06 PM
Restoring Toolbars and Other Things PosseJohn Excel Programming 1 May 13th 05 10:51 PM
Restoring Toolbars TJV Excel Programming 0 November 20th 03 05:14 PM


All times are GMT +1. The time now is 02:04 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"