-
Excel Menu
I'd like to create a new menu in an Excel Spread sheet. Now, I want it to be display ONLY with that specific spreadsheet. My customer already had an experience where a programmer put a new menu and it would come up every time he opened Excel.
I have done very little Excel code and don't know how to write any (either that it stays or the one that opens with that specific spread sheet).
Thanks
-
You can use the _Open and _BeforeClose events of the workbook to take the neccessary code.
If this workbook is opened the _Open code will be run (Changing the Menu) and if it is closed the _BeforeClosed code is run.(Change to the normal menu)
Note that another workbook might be already opened or be openened while yours is open, that might cause problems, as well as the double opening of your file (or a copy of that). But you can work around that.
-
The main problem is that the Menus and ComandBars are
Global to Excel. You would need to create a class of events for
each instance or workbooks opened. This would allow you to turn
on and off the menus or commandbars if your workbook is not
the active book. The _Deactivate event will not fire if there is
another workbook getting the focus that is not in your event
class. I havent herd or seen of anyone getting this working
correctly. :(
-
1 Attachment(s)
Ok, I got it. I made it so when you open the workbook it add
a new temporary menu "RobDog888" with some sub menus.
Then if you create a new workbook from within
the "MyEvents.xls" workbook, the "RobDog888" menu
dissapears. Also, since it it a temporary menu, if you create a new
workbook from outside of "MyEvents/xls" it will not have the new
menu. You can build on it to include a toolbar or commandbar
button or ???.
Note: Macros must be set to medium so you can enable them to
run or it wont work.