+ Reply to Thread
Results 1 to 4 of 4

Preserve objects when excel closes

  1. #1
    Registered User
    Join Date
    08-14-2014
    Location
    Portsmouth, England
    MS-Off Ver
    13
    Posts
    2

    Preserve objects when excel closes

    Dear All,

    I am new to the forum and was hoping that someone can help with my problem. Very grateful for the help already received from searching existing threads but can't find an answer to this one!

    My problem is I've created an object from a custom class and can adjust the properties of the object and run methods while excel is open; but when I close excel and reopen it, although I can still see the object on the screen (It's a speedometer), I can't adjust properties or run methods. I guess this is because the variable that represents the object has been destroyed. Does anybody know how to preserve the object when excel closes?

    Thanks for your help.

  2. #2
    Forum Expert Tsjallie's Avatar
    Join Date
    09-15-2012
    Location
    NL
    MS-Off Ver
    2010, 2013, 2016
    Posts
    2,077

    Re: Preserve objects when excel closes

    If you close excel all things in memory are lost. If you want to preserve data (like object properties) you need to store them somewhere (usually in a worksheet).
    Then you can reload these data when (re)opening the workbook.
    I can't adjust properties or run methods
    Not clear what you mean by that.
    Maybe you can post the workbook?
    Cheers!
    Tsjallie




    --------
    If your problem is solved, pls mark the thread SOLVED (see Thread Tools in the menu above). Thank you!

    If you think design is an expensive waste of time, try doing without ...

  3. #3
    Registered User
    Join Date
    08-14-2014
    Location
    Portsmouth, England
    MS-Off Ver
    13
    Posts
    2

    Re: Preserve objects when excel closes

    Hi,

    Thanks for your help. I've managed to solve the problem by checking to see if an object of the right type exists when the workbook is opened/reopened using the Workbook_Open event. If the object does exist (i.e. there are shapes in the workbook with a specific naming convention that have been drawn previously) it creates a variable of the custom class type and points it back at the object (the drawn shapes) so that their properties can be adjusted and the class methods can be run to make the shapes do things.

  4. #4
    Forum Expert Tsjallie's Avatar
    Join Date
    09-15-2012
    Location
    NL
    MS-Off Ver
    2010, 2013, 2016
    Posts
    2,077

    Re: Preserve objects when excel closes

    Glad your problem is solved. Hope I have contributed to that
    Please mark your thread as "solved".

+ 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. Excel Closes by itself
    By groundhog in forum Excel General
    Replies: 0
    Last Post: 03-16-2007, 09:35 AM
  2. Excel Closes By Itsself
    By clintd in forum Excel General
    Replies: 5
    Last Post: 03-07-2007, 06:41 PM
  3. Excel closes down during a macro
    By Muttley in forum Excel General
    Replies: 0
    Last Post: 01-24-2006, 08:30 AM
  4. Excel closes more than one worksheet
    By Ed in forum Excel General
    Replies: 2
    Last Post: 10-12-2005, 07:05 PM
  5. [SOLVED] Excel XP closes all windows
    By David French in forum Excel General
    Replies: 2
    Last Post: 08-24-2005, 10:05 AM

Tags for this Thread

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