Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Scope of Functions / Procedures - Excel XP

Status
Not open for further replies.

QSM

Technical User
Mar 29, 2007
6
NL
Good afternoon,

I've written some functions of my own which I want to use in several Excel Workbooks. So I created an Add-in (.xla) file to enable me to use the functions is several workbooks but only have to maintain one.

In the .xla file the are also some subprocedures / functions I would like to use in modules (in VBA) outside the Add-in Excelworkbook. But that is something I can not get to work as the systeem won't recognize the subs en functions in the other project.

Q: Is it possible to share procedures and functions between 2 Excelworkbooks? Perhaps there is another solution? Any help appreciated.

Kind regards,
 
Hello,

yes, you can call sub and functions from other workbooks, but they must be unique (at least the module name). You call them the same as within the workbook:

Call ModuleX.SomeSub()

I've once read that you can actually reference the other VBProject like this [YourAddin.xla].[ModuleX].SomeSub, but I've never managed to get that working.

Cheers,

Roel
 
Thanks for your quick answer. I'll try it!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top