ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   VB Macro Buttons (https://www.excelbanter.com/excel-programming/288846-vbulletin-macro-buttons.html)

Keda Wang

VB Macro Buttons
 
Hello,

I have successfully created macros on the Menu Bar,
however the buttons stay resident for all excel files. I
know it is possible to create the macro buttons to only be
loaded when the appropriate file is opened. The buttons
should disappear when the file is closed.

Does anyone know how to do this? If so, please share.
Thanks!



Rob van Gelder[_4_]

VB Macro Buttons
 
Keda,

You're looking for the Temporary parameter, which prevents Excel being stuck
with it.

You can have the Auto_Close procedure destroy the toolbar too.

Const cCommandBar = "MyCommandBar"
Dim bar As CommandBar
For Each bar In Application.CommandBars
If bar.Name = cCommandBar Then bar.Delete
Next

I have an example for Commandbars he
http://www.vangelder.co.nz/excel/index.html

Rob

"Keda Wang" wrote in message
...
Hello,

I have successfully created macros on the Menu Bar,
however the buttons stay resident for all excel files. I
know it is possible to create the macro buttons to only be
loaded when the appropriate file is opened. The buttons
should disappear when the file is closed.

Does anyone know how to do this? If so, please share.
Thanks!






All times are GMT +1. The time now is 07:46 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com