ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Refence a global in a another VBA Project (https://www.excelbanter.com/excel-programming/393308-refence-global-another-vba-project.html)

Chris Wilkinson

Refence a global in a another VBA Project
 
hi,

I have an application which has multiple workbooks open at a time. Is it
possible to get access to the global variable in the VBA Project for workbook
A from code in workbook B.

Thank you,
Chris

Jim Thomlinson

Refence a global in a another VBA Project
 
The best way is to create a refernce to the other workbook. By default your
workbook code is VBAProject (The code name in the VBE). If you right click on
the project and select properties you can change the name to something more
meaningful. Do this for both of the workbooks A and B. Now in workbook B
select Tools - References - and create a reference to workbook A (project
name). You can now directly reference the global variable in workbook A from
Workbook B.
--
HTH...

Jim Thomlinson


"Chris Wilkinson" wrote:

hi,

I have an application which has multiple workbooks open at a time. Is it
possible to get access to the global variable in the VBA Project for workbook
A from code in workbook B.

Thank you,
Chris



All times are GMT +1. The time now is 03:32 PM.

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