ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Declare at application level (https://www.excelbanter.com/excel-programming/333056-declare-application-level.html)

MD

Declare at application level
 
Good day, I wanted to know if it is possible to declare a variable at the
application level. In other words, as a workbook opens it sets the value of
a variable so that all other workbooks can use that value without have to
declare it in each workbook.

ie;

worbook1 opens and declares variable X as "\\mypath\"

as worbook2 opens, it has code that will have the X variable in it and
should know that X is "mypath" without declaring it in workbook2



Jim Rech

Declare at application level
 
I think you might want to write the variable to some external location like
the registry or a text file. If the former case using GetSetting and
SaveSetting is pretty convenient way to access it.

--
Jim
"MD" wrote in message
...
| Good day, I wanted to know if it is possible to declare a variable at the
| application level. In other words, as a workbook opens it sets the value
of
| a variable so that all other workbooks can use that value without have to
| declare it in each workbook.
|
| ie;
|
| worbook1 opens and declares variable X as "\\mypath\"
|
| as worbook2 opens, it has code that will have the X variable in it and
| should know that X is "mypath" without declaring it in workbook2
|
|




All times are GMT +1. The time now is 11:16 PM.

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