ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Accessing VBA subroutines in another workbook (https://www.excelbanter.com/excel-programming/313203-accessing-vba-subroutines-another-workbook.html)

[email protected]

Accessing VBA subroutines in another workbook
 
Is it possible to invoke
subroutines in another workbook if those
subroutines are not private?


keepITcool

Accessing VBA subroutines in another workbook
 


The called workbook (or addin) must be open.
(if it's referenced it will be opened automatically)


IF it's NOT referenced:

Run "MyFunctions.xla!sayhi"
Dim v
v = Run("MyFunctions.xla!doublethis", Range("a1"))

If you added a reference to that workbook in Tools/References
then you'd call it like any other procedure in the workbook.
(Note you have to rename the Project in the referenced workbook
so it wont conflict with the "calling" workbook's project name.

Assume the project in MyFunctions.xls is named prjFunctions

SayHi
of prjFunction.SayHi




keepITcool

< email : keepitcool chello nl (with @ and .)
< homepage: http://members.chello.nl/keepitcool


" wrote:

Is it possible to invoke
subroutines in another workbook if those
subroutines are not private?





All times are GMT +1. The time now is 12:20 PM.

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