Home |
Search |
Today's Posts |
#7
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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 |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Restoring | Excel Discussion (Misc queries) | |||
Removing/restoring toolbars | Excel Programming | |||
Removing and Restoring Excel toolbars | Excel Programming | |||
Restoring Toolbars and Other Things | Excel Programming | |||
Restoring Toolbars | Excel Programming |