Make a Sub/Function global to ALL WorkBooks?

A

ArtDeFart32

I am using Excel 2007 and XP. I wrote some subroutines and functions that I
would like to be able to use in ANY WorkBook.

As a simple example function:

Function aaa()

aaa = "Results of this function"

End Function

--------------------------------------

In ANY Workbook:

sub zzz()

dim xxx as string

xxx=aaa

end sub

I've been trying ADDins, XLSTART Folder, Personal.XLSB, setting references,
but I seem to be missing something. Setting a reference to the workbook that
contains the function (aaa) does work, but then how do you set the reference
for ALL WorkBooks?

Thanks for any insight,

Art
 
D

Dave Peterson

Each workbook will need to have the reference added.

Alternatively, you could use application.run, but then the workbook with the
function will need to be opened (by your code???) first.
 
P

Paul

I use DP's method, modified by having my Macrs.xls file in XLSTART, and
running code to open the main file of macros (in hidden mode) from the
Macros.xls Auto Open.

This keeps the Macros.xls file relatively clean, and distribution much easier
 

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