I try to access public variables in other Excel files (which are referenced) without hard coding the excel file/VBA project and need help in achieving this. I need the qualification as multiple files with similar variables can be open.
Assume you have a VBA project Test(Test.xlsb)
which defined a public variable myVar
.
In another VBA project (which has a reference to Test
) I can access this variable , e.g.
debug.print Test.myVar
However I have been unable to achieve the same without using the qualifier Test
. I tried to use aworkBook
, VBProject
and Reference
as qualifier but none of these options works out. I also cannot assign the object addressed by the code name to a variable. The code set myObj = Test
throws a compiler error, while set mySheet = Test.Sheet1
does work.
Any help appreciated.