+ Reply to Thread
Results 1 to 5 of 5

Global Variables

  1. #1
    Registered User
    Join Date
    02-03-2006
    Location
    Canada
    Posts
    18

    Global Variables

    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

  2. #2
    Tushar Mehta
    Guest

    Re: 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 <[email protected]>,
    [email protected] 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
    >
    >


  3. #3
    Tom Ogilvy
    Guest

    Re: 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" <[email protected]> wrote in
    message news:[email protected]...
    >
    > 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
    >




  4. #4
    Registered User
    Join Date
    02-03-2006
    Location
    Canada
    Posts
    18
    Sounds good

    Thanks Tom!

  5. #5
    Jim Thomlinson
    Guest

    Re: 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
    >
    >


+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1