ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Unloading /Closing all userforms (https://www.excelbanter.com/excel-programming/403441-unloading-closing-all-userforms.html)

dunnerca

Unloading /Closing all userforms
 
I've searched all over and cannot find an example of coding that will close
all open user forms. I'm thinking something like

For i = 1 To Controls("msforms").Count
Unload ?
Next

As you can see, that's a really rough estimate of what's needed.

Bob Phillips

Unloading /Closing all userforms
 
Dim frm As UserForm
For Each frm In UserForms
Unload frm
Next frm


--
HTH

Bob

(there's no email, no snail mail, but somewhere should be gmail in my addy)

"dunnerca" wrote in message
...
I've searched all over and cannot find an example of coding that will
close
all open user forms. I'm thinking something like

For i = 1 To Controls("msforms").Count
Unload ?
Next

As you can see, that's a really rough estimate of what's needed.




Jim Cone

Unloading /Closing all userforms
 
Something like this...

lngCount = UserForms.Count
If lngCount 0 Then
For N = lngCount To 1
Unload UserForms(N - 1)
Next
End If
--
Jim Cone
San Francisco, USA
http://www.realezsites.com/bus/primitivesoftware
(Excel Add-ins / Excel Programming)




"dunnerca" <
wrote in message
I've searched all over and cannot find an example of coding that will close
all open user forms. I'm thinking something like

For i = 1 To Controls("msforms").Count
Unload ?
Next

As you can see, that's a really rough estimate of what's needed.

joel

Unloading /Closing all userforms
 
For Each frm In VBA.UserForms
Unload frm
Next frm

You can get the names of each of the forms using frm.name

"dunnerca" wrote:

I've searched all over and cannot find an example of coding that will close
all open user forms. I'm thinking something like

For i = 1 To Controls("msforms").Count
Unload ?
Next

As you can see, that's a really rough estimate of what's needed.



All times are GMT +1. The time now is 10:35 AM.

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