ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Subroutine call without file reference (https://www.excelbanter.com/excel-programming/275227-re-subroutine-call-without-file-reference.html)

jaf

Subroutine call without file reference
 
Run Method Example

This example shows how to call the function macro My_Func_Sum, which is
defined on the macro sheet Mycustom.xlm (the macro sheet must be open). The
function takes two numeric arguments (1 and 5, in this example).

mySum = Application.Run("MYCUSTOM.XLM!My_Func_Sum", 1, 5)
MsgBox "Macro result: " & mySum
--

John

johnf202 at hotmail dot com


"Scott" wrote in message
...
Hello, I have a master workbook(1) that opens a second
workbook(2) and I would like to call a subroutine in
workbook(2) from workbook(1). The subroutine will perform
calculations in workbook(2).

I have found a way to do this by manually setting a
reference to workbook(2) in workbook(1), but I'd like to
do it without adding a reference.

Any help is greatly appreciated.

Thanks...Scott





All times are GMT +1. The time now is 05:15 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com