ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Run method for subroutines (https://www.excelbanter.com/excel-programming/275322-run-method-subroutines.html)

Scott

Run method for subroutines
 
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.

When I use the line:

Application.Run("CC.xla!Calculateconfig",var1,var2 )

I get an error saying it expects an “=”.

The subroutine I’m trying to call is in a workbook
called “CC.xla”, the “ThisWorkbook” module, and is
named “Calculateconfig”.

Any suggestions?


Tom Ogilvy

Run method for subroutines
 
Take the routine out of the ThisWorkbookModule and put it in a general
module.

Then it should work.

You should only put event code in the ThisWorkbook and sheet modules as a
general rule.

--
Regards,
Tom Ogilvy

"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.

When I use the line:

Application.Run("CC.xla!Calculateconfig",var1,var2 )

I get an error saying it expects an “=”.

The subroutine I’m trying to call is in a workbook
called “CC.xla”, the “ThisWorkbook” module, and is
named “Calculateconfig”.

Any suggestions?




All times are GMT +1. The time now is 08:48 PM.

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