![]() |
Calling a Sub in Personal.xls
I just can't find the right syntax.
In some workbook, I wish to call a Sub in my Personal.xls. Personal.xls is loaded, of course, and I can use its Macros from any workbook while in Excel. However, I cant find the right syntax to refer to Subs in that workbook from VBA. Help, -- Jim Parsells |
Calling a Sub in Personal.xls
Nevermind --- someday I'll learn which search terms will get me what I need.
Just in case someone else wants this -- KeyVal = Application.Run("Personal.xls!SomeFunction", KeyVal, 2, 0) You best be calling a function, because Application.Run turns all ByRef parameters into ByVal, so you won't be returning a value in one of the parameters. -- Jim Parsells "Jim Parsells" wrote: I just can't find the right syntax. In some workbook, I wish to call a Sub in my Personal.xls. Personal.xls is loaded, of course, and I can use its Macros from any workbook while in Excel. However, I cant find the right syntax to refer to Subs in that workbook from VBA. Help, -- Jim Parsells |
Calling a Sub in Personal.xls
Another option is to change the personal.xls project's name (from the generic
VBAProject) if you haven't already. (and save your personal.xls with that new project name.) Then use: Select the other workbook's project. Tools|References and create a reference to your personal.xls project. Then you can use the UDF just like it was built into excel: keyval = somefunction(keyval, 2, 0) Jim Parsells wrote: Nevermind --- someday I'll learn which search terms will get me what I need. Just in case someone else wants this -- KeyVal = Application.Run("Personal.xls!SomeFunction", KeyVal, 2, 0) You best be calling a function, because Application.Run turns all ByRef parameters into ByVal, so you won't be returning a value in one of the parameters. -- Jim Parsells "Jim Parsells" wrote: I just can't find the right syntax. In some workbook, I wish to call a Sub in my Personal.xls. Personal.xls is loaded, of course, and I can use its Macros from any workbook while in Excel. However, I cant find the right syntax to refer to Subs in that workbook from VBA. Help, -- Jim Parsells -- Dave Peterson |
All times are GMT +1. The time now is 03:42 AM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com