How to save a menu bar
Create an add-in. Do as you say and create the toolbar on AddinInstall,
then delete it on AddinUninstall. Then install the add-in, then close Excel
and reopen it. Does your toolbar reinstall itself? This is not the true
purpose of an add-in, imho. True, you get add-ins to close and will stay
gone if you press Cancel, but it's better than not having it at all.
Compare these two sets of codes ...
'Private Sub Workbook_AddinInstall()
' CreateMenu
'End Sub
'Private Sub Workbook_AddinUninstall()
' DeleteMenu
'End Sub
''--------------------------------------------------
'Private Sub Workbook_BeforeClose(Cancel As Boolean)
' DeleteMenu
'End Sub
'Private Sub Workbook_Open()
' CreateMenu
'End Sub
Uncomment them individually and run tests on them both.
Unless I missed something (which is highly possible :p ).
--
Regards,
Zack Barresse, aka firefytr
"Jim Thomlinson" wrote in message
...
Interesting... I don't agree but interesting... What functionallity for a
menu bar requires initializing on open or on close? I am hard pressed to
come
up with one. (at least for a generic set of utility type functions).
However
the before close event fires before Excel closes. If you hit cancel then
you
have already lost the menu bar but Excel is still open. This is kind of
annoying. Please fire back a response. I would love to know your
reasoning...
:-)
"zackb" wrote:
Sorry Jim, gotta disagree with ya there.
I would NOT use AddinInstall/Uninstall, but rather use the
Workbook_Open/BeforeClose events. There is a huge difference between
them.
The Install/Uninstall will only fire when you goto Tools | Addins, select
add-in and press Ok. The Open/BeforeClose procedures will fire everytime
you open/close Excel.
If you're looking for functionality that won't happen just on the initial
installation, use the Open/BeforeClose events of the add-ins workbook
module.
--
Regards,
Zack Barresse, aka firefytr
"Jim Thomlinson" wrote in
message
...
This is best accomplished with an Addin... In the addin include coee
simlar
to this in ThisWorkbook
Private Sub Workbook_AddinInstall()
AddMyMenu
End Sub
Private Sub Workbook_AddinUninstall()
DeleteMyMenu
End Sub
I know that your code has been improving by leaps and bounds so I will
not
go into the whole addin thing unless you want help... Best of Luck
HTH
"filo666" wrote:
Hi, I made a menu bar, I want to save my customized menu bar in a disk
an
copy to another computer, how???
The menu could be copied when I copy a file???
|