Reinitiate all vba variables in excel file without closing the file
Posted on 2015-02-03
Is it possible to re-initiate all Public variables (created by me in vba) in an excel file, so the file is returned to its status when it was originally opened?
My excel file carries out a repetitive process that creates new visio files with different content. Often I close the excel file between making each visio file. However, I would like sometimes to re-initiate the excel variables so I can create more than one visio file without closing excel.
To do this, I plan that the code in ThisWorkbook.Workbook_Open() would be moved into std_Open(), which would be standard code module.
When the file is first opened, std_Open would be called from ThisWorkbook.Workbook_Open() .
When the proposed re-initiation is carried out, it would be followed by executing the std_Open code, to simulate the opening of the file.
Is there a standard procedure for this requirement?