-
Sleeper: Memory Issue
Hi, i have no way of explaining this clearly so i will try my best.
I developed a VBA add-on that works with a userform. I access the userform from a button created in workbook_open code. The thing is the userform can read data form the sheets and create a structure ("type ...."). from the userform i can print some reports and modify the data to change the reports. Sometimes, moslty after printing a report, if I close the userform and then call it again form the button, all the public variables i had created and read before is lost and also all the changes i created earlier. Is there any way the public variables "survive" several closing and openings of the userform?
hope its clear enough.
-
Where are the piublic variab les defined, in a normal code module, or in the userform class module?
How do you clode the form, with Unload or Hide?
-
If you declare the variables you need as Public in a standard module they will available while the project is active.
As xld indicates,you could also have varibles declared in the user form and then hide/show the userform from the button (load on Workbook_Open and unload on Workbook_close.) This keeps it in memory so if it's used often there may be advantage to this.
K :-)
-
What about saving the variables to a file on disk, and reading them back the next time?
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules