add-ins

T

tommy

i needed to create a way to be able to use a macro and a reference for
mulitple workbooks and files, so i pulled up a blank spreadsheet
imported my macro, added my references, than saved it as an *.xla file
and now i have it as an add in, but now that it's an add in, how do i
reference the macro ?
 
T

Tom Ogilvy

Application.Run "MyAddin.xla!MyMacroName"

or if it returns a value

res = Application.Run("MyAddin.xla!MyMacroName")
 
A

Alex J

Tom,
I doing the same thing you suggested to tommy, I found that the
Application.Run fucntion only worked for me when the addin had no spaces in
its name. Is there a reason for this?

Regards,
Alex J
 
C

Chip Pearson

Alex,

If there are spaces in the file name, you need to enclose the
file name within single quotes. E.g.,

res = Application.Run ("'My Add In.xla'!MyMacroName")


--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting, LLC
www.cpearson.com
 

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

Top