Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Command Button Problem

Status
Not open for further replies.

funkmonsteruk

IS-IT--Management
Feb 8, 2002
210
GB
I've got an excel spreedsheet template which has several command buttons on it, i have re-named all of the command buttons.

When i insert the sheet from the template it re-names all of the command buttons back to their original titles (commandbutton1, commandbutton2 etc) This is anoying because i have to individually rename all the command buttons to get the assigned macros to work again.

Does anybody know a way around this?
 
Do your command buttons need to be renamed? cant you just leave them as defult, then when you create a new document from the template there are no changes made.

or

write this code in the "This Workbook" object and modify as necessary. It will run everytime workbook is opened renaming any buttons.

Sub Workbook_Open()
commandbutton1.name = "your new name 1"
commandbutton2.name = "your new name 2"
End Sub
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top