ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Global Variables (https://www.excelbanter.com/excel-programming/352317-global-variables.html)

mattsvai[_11_]

Global Variables
 

I have a directory with about 20 excel files and want them to all shar
the same global variables once they are run. I was thinking of doin
this by creating a "vars.ini" file in the same directory and have the
all load the variables once opened. This way I can set the ini fil
once, and it would affect all the excel files equally. Is this
feasible approach?

Matt

--
mattsva
-----------------------------------------------------------------------
mattsvai's Profile: http://www.excelforum.com/member.php...fo&userid=3113
View this thread: http://www.excelforum.com/showthread.php?threadid=50815


Tushar Mehta

Global Variables
 
Should work. You can also put things in the registry. Check out XL VBA
help for the 'SaveSetting' statement. Don't forget to check the 'See also'
links from that page.

--
Regards,

Tushar Mehta
www.tushar-mehta.com
Excel, PowerPoint, and VBA add-ins, tutorials
Custom MS Office productivity solutions

In article ,
says...

I have a directory with about 20 excel files and want them to all share
the same global variables once they are run. I was thinking of doing
this by creating a "vars.ini" file in the same directory and have them
all load the variables once opened. This way I can set the ini file
once, and it would affect all the excel files equally. Is this a
feasible approach?

Matts


--
mattsvai
------------------------------------------------------------------------
mattsvai's Profile:
http://www.excelforum.com/member.php...o&userid=31134
View this thread: http://www.excelforum.com/showthread...hreadid=508150



Tom Ogilvy

Global Variables
 
If you are talking about traditional global variables such as

Public MyVar

at the top of a module and you don't want to declare it at the top of the
module, then perhaps you could import a module with the declarations (a .bas
file - again this is nothing but a text file). If your talking about
declaring them, but initializing them by having your code opening an INI
file (which is nothing but a text file) and setting the values, then that is
feasible.

--
Regards,
Tom Ogilvy

"mattsvai" wrote in
message ...

I have a directory with about 20 excel files and want them to all share
the same global variables once they are run. I was thinking of doing
this by creating a "vars.ini" file in the same directory and have them
all load the variables once opened. This way I can set the ini file
once, and it would affect all the excel files equally. Is this a
feasible approach?

Matts


--
mattsvai
------------------------------------------------------------------------
mattsvai's Profile:

http://www.excelforum.com/member.php...o&userid=31134
View this thread: http://www.excelforum.com/showthread...hreadid=508150




mattsvai[_13_]

Global Variables
 

Sounds good :)

Thanks Tom

--
mattsva
-----------------------------------------------------------------------
mattsvai's Profile: http://www.excelforum.com/member.php...fo&userid=3113
View this thread: http://www.excelforum.com/showthread.php?threadid=50815


Jim Thomlinson[_5_]

Global Variables
 
I have a class for reading an INI file if it is of interest to you I could
send you a copy... It will make what you are about to do "plug and play"...
--
HTH...

Jim Thomlinson


"mattsvai" wrote:


Sounds good :)

Thanks Tom!


--
mattsvai
------------------------------------------------------------------------
mattsvai's Profile: http://www.excelforum.com/member.php...o&userid=31134
View this thread: http://www.excelforum.com/showthread...hreadid=508150




All times are GMT +1. The time now is 07:38 PM.

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