Activate Macro Button Located In Another File

  • Thread starter Thread starter Aria
  • Start date Start date
A

Aria

Hello,
My macro is located in macro.xls. How do you create the flexibilty to
be able rename this file and still be able to call it within another
file?

When I assign a button towards another file called Template.xls, I have
(Both files are opened at this point):
With mybutton
..OnAction="'Macro.xls'!ClearTemplate"
End With

If Macro.xls changes name prior to assign the button, how do I alter the
OnAction line? I've tried fiddling with;
Set curwksmacro = ActiveSheet
but I just couldn't point the OnAction line to refer to curwksmacro's
ClearTemplate macro.

Please help.

Thanks,
Aria
 
The code to assign the macro to the button is in the same file?

With mybutton
OnAction= "'" & thisworkbook.name & "'!ClearTemplate"
End With
 
Hi Dave,
It works. Thank-you so much. Yes, the code to assign the macro is also
within macro.xls.

Thank-you so much.
Aria :)
 

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