Public Function CloseChildForm() Dim i As Integer On Error Resume Next For i = Forms.Count - 1 To 0 Step -1 '判断窗口名称 If LCase(Forms(i).Name) <> LCase("frmP") Then If Forms(i).MDIChild = True Then Unload Forms(i) End If End If Next i End Function
Dim a As Form For Each a In Forms If LCase(a.Name) <> ("frmp") Then If a.MDIChild = True Then Unload a End If End If Next
Dim i As Integer
On Error Resume Next
For i = Forms.Count - 1 To 0 Step -1
'判断窗口名称
If LCase(Forms(i).Name) <> LCase("frmP") Then
If Forms(i).MDIChild = True Then
Unload Forms(i)
End If
End If
Next i
End Function
For Each a In Forms
If LCase(a.Name) <> ("frmp") Then
If a.MDIChild = True Then
Unload a
End If
End If
Next