Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
rgarber50
 
Posts: n/a
Default How do I add command buttom?


I've written a macro that I want to fire using a command button. I wrote
a macro that adds the button - and one that deletes it just fine.
However I am having problems automating the adding and the deleting of
the button on the standard toolbar - I only want it available for a
particular workbook.

I thought I should be using an event procedure. So I've tried
different combinations of:
Open
Before close
Workbook activate
deactivate.

In the event procedures I am either calling a procedure in a standard
module that adds the button, or a procedure that deletes the button on
the standard toolbar.

Sometimes it runs fine - other times it errors out - sometimes I end up
with multiple buttons. I want to be able to be able to activate another
workbook and have the btn deleted = when back add it again. I also want
to be able to close the workbook and have the button deleted.

Thanks for any suggestions.
Richard


--
rgarber50
------------------------------------------------------------------------
rgarber50's Profile: http://www.excelforum.com/member.php...o&userid=11350
View this thread: http://www.excelforum.com/showthread...hreadid=386011

  #2   Report Post  
Anne Troy
 
Posts: n/a
Default

It belongs in the Workbook_Open event.
You need to delete it on Before_Close.
*******************
~Anne Troy

www.OfficeArticles.com
www.MyExpertsOnline.com


"rgarber50" wrote
in message ...

I've written a macro that I want to fire using a command button. I wrote
a macro that adds the button - and one that deletes it just fine.
However I am having problems automating the adding and the deleting of
the button on the standard toolbar - I only want it available for a
particular workbook.

I thought I should be using an event procedure. So I've tried
different combinations of:
Open
Before close
Workbook activate
deactivate.

In the event procedures I am either calling a procedure in a standard
module that adds the button, or a procedure that deletes the button on
the standard toolbar.

Sometimes it runs fine - other times it errors out - sometimes I end up
with multiple buttons. I want to be able to be able to activate another
workbook and have the btn deleted = when back add it again. I also want
to be able to close the workbook and have the button deleted.

Thanks for any suggestions.
Richard


--
rgarber50
------------------------------------------------------------------------
rgarber50's Profile:

http://www.excelforum.com/member.php...o&userid=11350
View this thread: http://www.excelforum.com/showthread...hreadid=386011



Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



All times are GMT +1. The time now is 12:20 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"