Hide button from Template

D

Dennis

I have a macro linked to a command button on an excel template. I'd like to
have the button hidden (or deleted) on the new spreadsheet the user will save
to another name.
 
D

Dave Peterson

Not sure when you want the button deleted, but one way to delete it is:

Worksheets("sheet1").OLEObjects("CommandButton1").Delete

Chip Pearson has some instructions on how to remove code (or add code) on the
fly.
http://www.cpearson.com/excel/vbe.htm

Have you thought of removing the code (and button) from your template and using
another workbook for the code (maybe even a nice toolbar floating over your
workbook).
 
Top