+ Reply to Thread
Results 1 to 9 of 9

Q1: storing object state, Q2:accessing sheets while userform is displayed

  1. #1
    Registered User
    Join Date
    12-03-2014
    Location
    London
    MS-Off Ver
    MS office 2010
    Posts
    18

    Q1: storing object state, Q2:accessing sheets while userform is displayed

    Hey guys

    I've got 2 questions please if someone can shed some light into them...

    Question 1: regarding accessing the sheets while the userform is displayed

    I've got a userform that i run to do some updates on the sheets... now, when the form is shown, i can't access the sheets! Is there a way to be able to keep the form displayed while still be able to edit the sheet? (this can be potentially problematic, if someone edits something while a micro is running, I'm aware of this)

    (I know that i can put my form controls on one of the sheets, but I don't want to do that atm)

    Now if we assume this is not possible.... second question to come:

    Question 2: storing the state of an object?

    So why do I ask that... i have a number of bottons on the form, they are in two groups.... first group of buttons to be used before the sheet is updated manually... and then after that i want other sets of buttons to be used... now for these second round buttons i need an object that was previously generated in the first round...? But when i close the form (because I can't edit the sheets while it is there), the objects are terminated when i restart the userform again. How can i store the state of the object after closing the form if we can't access the sheets while the form is displayed?

    hope I'm making sense
    Dan
    Last edited by malleat1; 03-01-2015 at 10:36 AM.

  2. #2
    Forum Guru Norie's Avatar
    Join Date
    02-02-2005
    Location
    Stirling, Scotland
    MS-Off Ver
    Microsoft Office 365
    Posts
    19,646

    Re: Q1: storing object state, Q2:accessing sheets while userform is displayed

    Q1 Show the form modelesssly.

    Q2 Store the state somewhere, eg on a hidden worksheet and when the form is opened again set the state based on what's been stored.
    If posting code please use code tags, see here.

  3. #3
    Registered User
    Join Date
    12-03-2014
    Location
    London
    MS-Off Ver
    MS office 2010
    Posts
    18

    Re: Q1: storing object state, Q2:accessing sheets while userform is displayed

    Quote Originally Posted by Norie View Post
    Q1 Show the form modelesssly.
    Great, thanks for that...

    Quote Originally Posted by Norie View Post
    Q2 Store the state somewhere, eg on a hidden worksheet and when the form is opened again set the state based on what's been stored.
    emmm do-able, I'm just avoiding the double processing, to save it and re-extract it... it is a data of 200 records that gets extracted from 10,000 record data...

    Any other thoughts on that?

    Thanks a lot

  4. #4
    Forum Guru Norie's Avatar
    Join Date
    02-02-2005
    Location
    Stirling, Scotland
    MS-Off Ver
    Microsoft Office 365
    Posts
    19,646

    Re: Q1: storing object state, Q2:accessing sheets while userform is displayed

    How are you displaying these 200 records on the userform?

  5. #5
    Registered User
    Join Date
    12-03-2014
    Location
    London
    MS-Off Ver
    MS office 2010
    Posts
    18

    Re: Q1: storing object state, Q2:accessing sheets while userform is displayed

    Quote Originally Posted by Norie View Post
    How are you displaying these 200 records on the userform?
    I'm not displaying these, I'm storing them in a dictionary object, and using that dictionary object to fill in the spaces in the 10,000 records that happen to miss the info needed...

    So I need a way to store that dictionary object as is, and load it up later as is... is that do-able?

    In java, I can serialise an object and load it up in its same form...

    Thanks for coming back

  6. #6
    Forum Guru Norie's Avatar
    Join Date
    02-02-2005
    Location
    Stirling, Scotland
    MS-Off Ver
    Microsoft Office 365
    Posts
    19,646

    Re: Q1: storing object state, Q2:accessing sheets while userform is displayed

    What's on the form then?

  7. #7
    Registered User
    Join Date
    12-03-2014
    Location
    London
    MS-Off Ver
    MS office 2010
    Posts
    18

    Re: Q1: storing object state, Q2:accessing sheets while userform is displayed

    Quote Originally Posted by Norie View Post
    What's on the form then?
    The userform contains the controls needed to prorcess the sheets (buttons and lists)...

    In short, I have a file of 10,000 records, this file needs to be modified on regular basis, so i process it to generate pivot table and what not, during the processing that dictionary object is created to fill in empty spaces in the records...
    and then once the tables are generated, we either edit automatically (using a rule based engine I've created) or manually.... then after that, the whole tables and degenerated back into a CSV file.

    Hope I've made sense :D
    Thanks
    Dan

  8. #8
    Registered User
    Join Date
    12-03-2014
    Location
    London
    MS-Off Ver
    MS office 2010
    Posts
    18

    Re: Q1: storing object state, Q2:accessing sheets while userform is displayed

    Ah I figured out what the problem is... this post is for anyone experiencing similer issues

    I was storing the dictionary as public, which is good... but the problem I had is that everytime I closed the userform and restarted it from *design* VBA IDE view, it discarded the values of the global variables!

    To avoid that, I need to call the userform from the sheet view itself... that way the global variables retain their value even after closing the form! Great!

  9. #9
    Registered User
    Join Date
    12-03-2014
    Location
    London
    MS-Off Ver
    MS office 2010
    Posts
    18

    Re: Q1: storing object state, Q2:accessing sheets while userform is displayed

    Ah I figured out what the problem is... this post is for anyone experiencing similer issues

    I was storing the dictionary as public, which is good... but the problem I had is that everytime I closed the userform and restarted it from *design* VBA IDE view, it discarded the values of the global variables!

    To avoid that, I need to call the userform from the sheet view itself... that way the global variables retain their value even after closing the form! Great!

+ 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. Problem Storing Object
    By YMX in forum Excel Programming / VBA / Macros
    Replies: 12
    Last Post: 10-09-2013, 10:29 AM
  2. Accessing variables assigned in one userform by a second userform?
    By jerseyguy1996 in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 11-30-2009, 04:12 PM
  3. Error when accessing VBIDE object
    By Marcelo Rychter in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 08-25-2008, 03:49 PM
  4. Storing State in Excel Workbook.
    By IDislikeExcel in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 06-13-2007, 01:16 PM
  5. [SOLVED] Accessing an Embedded Project Object in Spreadsheet
    By Prismo in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 02-16-2005, 03:51 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