ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Releasing all Userforms in memory (https://www.excelbanter.com/excel-programming/307967-releasing-all-userforms-memory.html)

Rich[_24_]

Releasing all Userforms in memory
 
VBA provides methods to Hide (which keeps it in memory and
programmatically available) and Unload (which supposedly
removes all traces of the form until it's loaded again)
any given form.

But is there a way to unload any and all forms that are
presently in memory?

Thanks for any input.


Tom Ogilvy

Releasing all Userforms in memory
 
Sub Tester1()
Dim frm As UserForm
Dim frm1 As UserForm1
Dim frm2 As UserForm1
Dim frm3 As UserForm1
Set frm1 = New UserForm1
Set frm2 = New UserForm1
Set frm3 = New UserForm1
Debug.Print UserForms.Count
For Each frm In UserForms
Unload frm
Next
Debug.Print UserForms.Count
End Sub


3
0

is the result.

--
Regards,
Tom Ogilvy




"Rich" wrote in message
...
VBA provides methods to Hide (which keeps it in memory and
programmatically available) and Unload (which supposedly
removes all traces of the form until it's loaded again)
any given form.

But is there a way to unload any and all forms that are
presently in memory?

Thanks for any input.





All times are GMT +1. The time now is 08:41 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com