ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Calling a Public Subroutine in a Different Workbook (https://www.excelbanter.com/excel-programming/338119-calling-public-subroutine-different-workbook.html)

Raul

Calling a Public Subroutine in a Different Workbook
 
I have a public subroutine called routine1() located in in workbook called
Routines.xls and I would like to call routine1() from another workbook called
Book1.xls. What is the proper syntax or methodology for doing this? I'm
missing something.....

Thanks in advance,
Raul

[email protected]

Calling a Public Subroutine in a Different Workbook
 
To run a sub use:
Application.Run "WorkbookName!MacroName"
To run a function use:
ReturnValue = Application.Run("WorkbookName!MacroName")

You can add any arguments that your functions call after the macro
name. The relevant xl file will have to be open though.

Hope that helps,
Andrew


Raul wrote:
I have a public subroutine called routine1() located in in workbook called
Routines.xls and I would like to call routine1() from another workbook called
Book1.xls. What is the proper syntax or methodology for doing this? I'm
missing something.....

Thanks in advance,
Raul



Raul

Calling a Public Subroutine in a Different Workbook
 
That did the trick.

Thank you very much,
Raul

" wrote:

To run a sub use:
Application.Run "WorkbookName!MacroName"
To run a function use:
ReturnValue = Application.Run("WorkbookName!MacroName")

You can add any arguments that your functions call after the macro
name. The relevant xl file will have to be open though.

Hope that helps,
Andrew


Raul wrote:
I have a public subroutine called routine1() located in in workbook called
Routines.xls and I would like to call routine1() from another workbook called
Book1.xls. What is the proper syntax or methodology for doing this? I'm
missing something.....

Thanks in advance,
Raul





All times are GMT +1. The time now is 08:51 AM.

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