PC Review


Reply
Thread Tools Rate Thread

Activate Macro Button Located In Another File

 
 
Aria
Guest
Posts: n/a
 
      26th Oct 2006
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




*** Sent via Developersdex http://www.developersdex.com ***
 
Reply With Quote
 
 
 
 
Dave Peterson
Guest
Posts: n/a
 
      26th Oct 2006
The code to assign the macro to the button is in the same file?

With mybutton
OnAction= "'" & thisworkbook.name & "'!ClearTemplate"
End With

Aria wrote:
>
> 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
>
> *** Sent via Developersdex http://www.developersdex.com ***


--

Dave Peterson
 
Reply With Quote
 
Aria
Guest
Posts: n/a
 
      26th Oct 2006
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

*** Sent via Developersdex http://www.developersdex.com ***
 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
button in a cell to activate a macro alexfair Microsoft Excel Worksheet Functions 6 30th May 2008 03:09 PM
Button to activate a macro =?Utf-8?B?RGFuaWVs?= Microsoft Excel Programming 5 15th Aug 2007 09:10 PM
Button to activate macro =?Utf-8?B?cmlja19tYw==?= Microsoft Excel Programming 2 29th Mar 2007 01:24 AM
Re: Macro to activate form button kkknie Microsoft Excel Programming 1 11th May 2004 08:31 PM
Button to Activate Macro =?Utf-8?B?Sm9u?= Microsoft Excel Misc 3 24th Feb 2004 12:15 AM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 09:36 PM.