Close All MDI Children Simply

By | 2002-06-01

This code allows you to close all the MDI child forms in an MDI form at once.
Goto http://www.vbgreatone.com/ to learn like you’ve never learned before. Get over 500 api functions with example for each, and tips like this and, much much more. Just visit it, i’m sure you will like it.
First, create a menu item in the MDI form name mnuCloseAll, then paste in this code:

Original Author: VBGreatone (http://www.vbg1.com)

Code

Private Sub mnuCloseAll_Click()
Screen.MousePointer = vbHourglass
Do While Not (Me.ActiveForm Is Nothing)
  Unload Me.ActiveForm
Loop
Screen.MousePointer = vbDefault
End Sub
'Once the user clicks on that menu item, the MDI child forms will close.

Author: dwirch

Derek Wirch is a seasoned IT professional with an impressive career dating back to 1986. He brings a wealth of knowledge and hands-on experience that is invaluable to those embarking on their journey in the tech industry.

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.