View Single Post
  #3   Report Post  
Posted to microsoft.public.excel.programming
Paul Paul is offline
external usenet poster
 
Posts: 661
Default Make a Sub/Function global to ALL WorkBooks?

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

"Dave Peterson" wrote:

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.





ArtDeFart32 wrote:

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


--

Dave Peterson
.