Dim myform As Form
Dim count As Integer
For Each myform In Forms
If myform.Name <> "MDIForm1" Then
If myform.MDIChild = True Then
count = count + 1
End If
End If
Next
MsgBox (count)
This example is using the Forms Collection. Make an MDIForm with a PictureBox on it and Place this code into the Click Event of it. (Make sure you have another Form called Form1 and set the MDIChild property to True.
Code:
Private Sub Picture1_Click()
Dim NewForm As Form1
Set NewForm = New Form1
NewForm.Show
MsgBox (Forms.Count - 1)
End Sub