+ Reply to Thread
Results 1 to 3 of 3

VBA Macro - save / restore variables when closing / opening Excel?

  1. #1
    Registered User
    Join Date
    02-11-2021
    Location
    Austin, TX
    MS-Off Ver
    360
    Posts
    1

    VBA Macro - save / restore variables when closing / opening Excel?

    I have an application that I have been nursing for a few years. One thing that I need to do is have it save all of the variables when I close Excel, so that when I open it again I can continue editing.
    Is there a straight-forward way to do this? I am hoping for a dump to a file that can be reloaded later using a button / macro.
    Thanks
    dan

  2. #2
    Forum Guru TMS's Avatar
    Join Date
    07-15-2010
    Location
    The Great City of Manchester, NW England ;-)
    MS-Off Ver
    MSO 2007,2010,365
    Posts
    48,994

    Re: VBA Macro - save / restore variables when closing / opening Excel?

    The easiest way would be to store the variables/parameters in a hidden worksheet in the workbook. No chance of them being lost or corrupted in an external file.
    Trevor Shuttleworth - Retired Excel/VBA Consultant

    I dream of a better world where chickens can cross the road without having their motives questioned

    'Being unapologetic means never having to say you're sorry' John Cooper Clarke


  3. #3
    Forum Expert ByteMarks's Avatar
    Join Date
    07-23-2018
    Location
    UK
    MS-Off Ver
    O365 32bit (Windows)
    Posts
    3,175

    Re: VBA Macro - save / restore variables when closing / opening Excel?

    For a file dump option you could save the variables to an ini file.

    Put this in a module
    Please Login or Register  to view this content.
    Please Login or Register  to view this content.
    Please Login or Register  to view this content.

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. Restore Workbook to Default Upon Closing
    By Jim Clayton in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 12-18-2019, 06:25 PM
  2. calculate difference in opening and closing only when closing decreases
    By juriemagic in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 05-23-2019, 04:07 AM
  3. [SOLVED] Macro to copy 3 cells to table on opening or closing
    By JohnDoh in forum Excel Programming / VBA / Macros
    Replies: 10
    Last Post: 04-07-2015, 09:25 AM
  4. Opening, Closing, and Opening Excel workbooks from MS Project
    By m007schneider in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 04-04-2013, 03:22 PM
  5. How to save user form checkbox values when opening and closing workbook
    By skfinance in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 02-13-2011, 06:28 PM
  6. Calculation macro upon opening and closing
    By pauldaddyadams in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 05-16-2008, 03:46 PM
  7. Re: Opening and closing files in a Macro
    By Henry Stock in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 02-18-2005, 03:00 PM

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