我有一个隐藏应用程序的用户窗体。但是,当我关闭用户窗体并设置application,visible = true时,该应用程序变为可见,但是创建了两个无法关闭的excel新实例,除了通过杀死任务之外。在旧版本的excel上,此代码可以完美运行。
希望有人可以提供帮助。 :)
Private Sub UserForm_Activate()
Dim rs As Worksheet
Dim rngWA As Range
Set rs = Worksheets("VenDetail")
Set rngWA = rs.Range("B2:B" & rs.Cells(Rows.count, "B").End(xlUp).Row + 2)
With Me.ListBox1
.ColumnCount = 1
.ColumnWidths = "300"
.RowSource = "VenDetail!" & rngWA.Address
End With
Application.Visible = False
End Sub
Private Sub UserForm_QueryClose(Cancel As Integer, CloseMode As Integer)
Application.Visible = True
Unload Me
End Sub