VB Macro Buttons

  • Thread starter Thread starter Keda Wang
  • Start date Start date
K

Keda Wang

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!
 
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 here:
http://www.vangelder.co.nz/excel/index.html

Rob
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top