![]() |
How to Call Functions in the Personal Workbook?
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 |
How to Call Functions in the Personal Workbook?
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) SteveM wrote: 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 |
All times are GMT +1. The time now is 11:24 AM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com