Calling Add-In subroutines from other modules

S

sclark

I have a bunch of common subroutines that I have placed in an Add-In module. This module is available whenever I open Excel, but I cannot reference the subroutines in the Add-In module, from other workbook modules. How is this done?

Steve
 
T

Tom Ogilvy

With your workbook that needs to reference it as the active project,

in the VBE, Tools=>References and select the ADDIN

--
Regards,
Tom Ogilvy

sclark said:
I have a bunch of common subroutines that I have placed in an Add-In
module. This module is available whenever I open Excel, but I cannot
reference the subroutines in the Add-In module, from other workbook modules.
How is this done?
 
S

sclark

Tom, I do have the add-in, and I can see it in the
project list with any workbook i open. However, if I try
to call a subroutine that is in the Add-In, FROM another
workbook module, it doesn't find the routine. If I copy
that routine into the workbook module I am calling from,
it works fine.

Steve
 
T

Tom Ogilvy

I understand and if you create a reference to the addin as I described, then
it will find the routine.

If you don't want to create the reference, then use application.Run see
help for details.
 
S

sclark

Tom, Thanks for the reply. I will try that. I misunderstood, thinking that I had already referenced the module as an Add-In.

Steve
 
S

sclark

Still don't get it. The addin (my custom Add-In) which is visible in the project window for ANY workbook I have open, is not in the list of references, so I cannot select it via Tools/References menu. I can try the application run as well. Any thoughts

Steve
 
C

Chip Pearson

Steve,

With the add-in loaded in VBA, go to the Tools menu and choose
VBA Project Properties. In that dialog, give the project a
unique name, like "MyAddInProject" or something. Then, open
workbook which will reference the add-in project. Go to the Tools
menu, choose References, and put a check next to the add-in's
project (not file) name.


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


sclark said:
Still don't get it. The addin (my custom Add-In) which is
visible in the project window for ANY workbook I have open, is
not in the list of references, so I cannot select it via
Tools/References menu. I can try the application run as well.
Any thoughts?
 
Top