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 Westi on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Assign macro to button: Do not include worksheet reference 1

Status
Not open for further replies.

artsandcraftshome

Technical User
Mar 24, 2003
13
US
I have had this problem when assigning a macro to a button-
sometimes it will add the workbook reference, sometimes not. When it does, it tries to open the same workbook and gives me an error. I have another macro in the same workbook that it does not attach the workbook reference to and it works just fine. Does anybody know how to assign the macro without the workbook reference?
Here's what I get:

'e-calc.xls'!eMD.eMD

Here's what I want:
eMD (just the name of the macro)

thanks again-
John
 
An easier option would be to draw your command button as a control rather than a form button. When in design view then double-click the control button you have drawn. A new private sub is generated in the VB editor. Type the name of your macro at the cursor and compile.

A control button is easier to protect than a form button and you can also change the colours and add useful events to it ect.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top