razvanl
asked on
Unloading all forms before exiting
Hi,
I would like to know if there is a way to unload all the loaded forms in a program when you exit. Other than typing 20 or so unload formname, is there another solution?
I am under the impression that VB doesn't exactly do a good cleanup after you close a program, and on some computers it gives a crash in module <unknown> (which helps a lot). I suspect that this may be caused by some parts of the program remaining loaded in memory.
Sincerely,
Razvan Loghin
I would like to know if there is a way to unload all the loaded forms in a program when you exit. Other than typing 20 or so unload formname, is there another solution?
I am under the impression that VB doesn't exactly do a good cleanup after you close a program, and on some computers it gives a crash in module <unknown> (which helps a lot). I suspect that this may be caused by some parts of the program remaining loaded in memory.
Sincerely,
Razvan Loghin
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
The topmost window can be accessed as ActiveForm
Dim objAF As Object
Set objAF = Screen.ActiveForm
do while not ofjAF Is Nothing
Unload objAF
Set objAF = Screen.ActiveForm
loop
then follow with edunc's code to unload any remaining hidden forms.