请告知我们如何仅显示userform
而不是在其背后擅长。
我使用application.visible = false
,但它隐藏了所有其他excel。
我使用了activatewindow.visible = false
,但userform
没有从excel中检索数据。
我使用activatewindow.displayworkbooktabs=false
但它没有隐藏工作簿。
答案 0 :(得分:0)
试试这段代码。
Private Sub Workbook_Open()
Application.Visible = False
UserForm1.Show vbModeless
End Sub
不要忘记在关闭之前使应用程序可见
Private Sub UserForm_QueryClose(Cancel As Integer, CloseMode As Integer)
Application.Visible = True
End Sub
答案 1 :(得分:0)
将此内容写入userform:
Private Sub CommandButton1_Click()
Dim wCount As Long
Dim i As Long
wCount = Windows.Count
For i = 1 To wCount
Windows(i).Visible = True
Next i
Unload Me
End Sub
Private Sub UserForm_Initialize()
Dim wCount As Long
Dim i As Long
wCount = Windows.Count
For i = wCount To 1 Step -1
Windows(i).Visible = False
Next i
End Sub