Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
DiscussionsAccessExcelInfoPathOutlookPowerPointPublisherWord
DirectoryUser Groups
Related Topics
Outlook ExpressInternet ExplorerWindowsMS Server ProductsMore Topics ...

MS Office Forum / Excel / Programming / December 2007

Tip: Looking for answers? Try searching our database.

How to Call Functions in the Personal Workbook?

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
SteveM - 18 Dec 2007 14:59 GMT
I'm working on an Excel Project and would like to use some utility
functions resident in my Personal Workbook.  Is there a simple/
standard way to access those functions from the other Project?

Or is cutting and pasting the code the non-elegant, best way?

Thanks Much,

SteveM
Dave Peterson - 18 Dec 2007 15:07 GMT
In a formula in a cell:
=personal.xls!myfunct(a1:b99)

If you saved your personal workbook as an addin (personal.xla), then you can
refer to the functions in that addin just like they were built into excel:
=myfunct(a1:b99)

If you want to access the functions in your other project (via code), you have a
couple of choices.

You could add a reference in the "receiving" project that points at the
"sending" project.

First, it's probably better to give the "sending" project a nice unique name.
Open the VBE
Hit ctrl-r to see the project explorer
select your workbook's project.  
It should look something like:  VBAProject (book1.xls)
Hit F4 to see the properties window
Type the new name in the (Name) property

Save this workbook.

Select the "receiving" project
Tools|References
Look for that nice unique name and select it (check it).

Then you can use the functions in that other workbook just like they're built
into VBA.

Dim Resp as long
resp = myFunct(activesheet.range("a1:A7")

======

The second way to have your code call a function in another workbook's project
is to use Application.run:

application.run "'FullfileName.xls'!macroname", myargument
or to return something:
resp = application.run("'fullfilename.xls"'!macroname, myargument)

> I'm working on an Excel Project and would like to use some utility
> functions resident in my Personal Workbook.  Is there a simple/
[quoted text clipped - 5 lines]
>
> SteveM

Signature

Dave Peterson

 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.