1、代码改成比如
Dim tabc As WinForm.TabControl
tabc=e.Form.Controls("TabControl1")
Dim str As String
str=tabc.SelectedPage.Text
If tabc.SelectedIndex<>0 Then
If Forms(str).Opened=True
e.Form.controls("table1").visible = False
tabc.TabPages.Delete(str)
Forms(str).Close
End If
End If
2、不建议你这样做,尽量用下面这种方法插入窗口
http://www.foxtable.com/bbs/dispbbs.asp?BoardID=2&ID=127551&skin=0