ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   add-ins (https://www.excelbanter.com/excel-programming/308237-add-ins.html)

tommy

add-ins
 
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 ?

Tom Ogilvy

add-ins
 
Application.Run "MyAddin.xla!MyMacroName"

or if it returns a value

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

--
Regards,
Tom Ogilvy

"tommy" wrote in message
...
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 ?




tommy

add-ins
 
Tom Ogilvy wrote:

Application.Run "MyAddin.xla!MyMacroName"

or if it returns a value

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


your the man the tom!!!

Alex J

add-ins
 
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


"Tom Ogilvy" wrote in message
...
Application.Run "MyAddin.xla!MyMacroName"

or if it returns a value

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

--
Regards,
Tom Ogilvy

"tommy" wrote in message
...
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 ?






Chip Pearson

add-ins
 
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



"Alex J" wrote in message
. ..
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


"Tom Ogilvy" wrote in message
...
Application.Run "MyAddin.xla!MyMacroName"

or if it returns a value

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

--
Regards,
Tom Ogilvy

"tommy" wrote in message
...
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 ?









All times are GMT +1. The time now is 10:26 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com