你可以在打开一个窗口前将其它窗口都关闭,代码如下: Private Sub Mnu_closeall_Click() '关闭所有MDI子窗体 'Screen.MousePointer = vbHourglass Do While Not (Me.ActiveForm Is Nothing) Unload Me.ActiveForm Loop 'Screen.MousePointer = vbDefault End Sub
可以用App的PrevInstance来判断 如: if app.previnstance then unload me end if
Private Sub Mnu_closeall_Click()
'关闭所有MDI子窗体
'Screen.MousePointer = vbHourglass
Do While Not (Me.ActiveForm Is Nothing)
Unload Me.ActiveForm
Loop
'Screen.MousePointer = vbDefault
End Sub
如:
if app.previnstance then
unload me
end if