How to call a macro in an XLA add-in

  • Thread starter Thread starter Peter Laman
  • Start date Start date
P

Peter Laman

Hello,

This is an XLA newbie question (for Excel 2000)!

I created an Excel addin (.xla type) with a macro in it and I
installed the add-in. Then I opened another workbook, activated my VBA
form and yes, there it was, my add-in.

But now I want to create a macro in the workbook that calls a macro
from the add-in (with parameters). How can I do that? My end goal of
this is to create an add-in as a subroutine and function library for
an extensive set of Excel sheets that need to be developed.

Thanks for any help!
 
This was just posted by Rob Bovey:

Application.Run "'YourAdd-in.xla'!YourSubName", Arg1, Arg2, ....

Just for completeness, if the routine is a function and you want to capture
the return value, you write it as

x = Application.Run("'YourAdd-in.xla'!YourSubName", Arg1, Arg2)

========
Another alternative would be to add a reference to your workbook that points at
your addin.

Give your addin a nice unique project name (not VBAProject) and then with your
other workbook's project active:

Tools|references|
click on that addin's project.

Then you can use your functions/subs in the addin just like they were part of
that same project.
 

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