具体工作簿不可见 Excel VBA
Specific workbook invisible Excel VBA
我正在 Excel VBA 中编写脚本,其中 Workbook
应该以 UserForm
打开。我只希望 UserForm
可见,而 excel window 本身不可见。因此,我编写了以下用于打开 Workbook
的代码:
Private Sub Workbook_Open()
'Application launch
Application.Visible = False 'Hide Excel window
EnableResize = False
Application.DisplayFullScreen = True 'Preset fullscreeen mode
Application.CommandBars("Full Screen").Enabled = False 'Hide command bars
WelcomeForm.Show 'Show welcome UserForm
End Sub
我意识到我已将整个 Excel 应用程序设置为不可见。从这个意义上说,现在发生的情况是,当我打开其他 Excel 个工作簿时,一旦我打开这个工作簿,它们就会变得不可见。我怎样才能使这个设置只适用于这个特定的工作簿?谢谢
部分回答:你也可以设置window属性.Visible
ThisWorkbook.Windows(1).Visible = False
但是这不会隐藏应用程序(如果您只打开一个工作簿,将会有一个空的 Excel window)所以您需要先检查一下
If Application.Workbooks.Count > 1 Then
ThisWorkbook.Windows(1).Visible = False
Else
Application.Visible = False
End If
这里有一个选择:
Sub HideSheet()
Dim sheet As Worksheet
Set sheet = ActiveSheet
' Hides the sheet but users will be able to unhide it using the Excel UI
sheet.Visible = xlSheetHidden
' Hides the sheet so that it can only be made visible using VBA
sheet.Visible = xlSheetVeryHidden
End Sub
this SO question中有更多详细信息
您可以做的是以下
private sub workbook_open ()
userform.activate
end sub
然后在用户窗体代码中写入
Private sub userform_intialize()
application.screenupdate =false
end sub
现在您只在开始时看到表格
我不知道如何解决的一个问题是,当您移动 window.
时,您仍然会看到旧版本
我正在 Excel VBA 中编写脚本,其中 Workbook
应该以 UserForm
打开。我只希望 UserForm
可见,而 excel window 本身不可见。因此,我编写了以下用于打开 Workbook
的代码:
Private Sub Workbook_Open()
'Application launch
Application.Visible = False 'Hide Excel window
EnableResize = False
Application.DisplayFullScreen = True 'Preset fullscreeen mode
Application.CommandBars("Full Screen").Enabled = False 'Hide command bars
WelcomeForm.Show 'Show welcome UserForm
End Sub
我意识到我已将整个 Excel 应用程序设置为不可见。从这个意义上说,现在发生的情况是,当我打开其他 Excel 个工作簿时,一旦我打开这个工作簿,它们就会变得不可见。我怎样才能使这个设置只适用于这个特定的工作簿?谢谢
部分回答:你也可以设置window属性.Visible
ThisWorkbook.Windows(1).Visible = False
但是这不会隐藏应用程序(如果您只打开一个工作簿,将会有一个空的 Excel window)所以您需要先检查一下
If Application.Workbooks.Count > 1 Then
ThisWorkbook.Windows(1).Visible = False
Else
Application.Visible = False
End If
这里有一个选择:
Sub HideSheet()
Dim sheet As Worksheet
Set sheet = ActiveSheet
' Hides the sheet but users will be able to unhide it using the Excel UI
sheet.Visible = xlSheetHidden
' Hides the sheet so that it can only be made visible using VBA
sheet.Visible = xlSheetVeryHidden
End Sub
this SO question中有更多详细信息
您可以做的是以下
private sub workbook_open ()
userform.activate
end sub
然后在用户窗体代码中写入
Private sub userform_intialize()
application.screenupdate =false
end sub
现在您只在开始时看到表格
我不知道如何解决的一个问题是,当您移动 window.
时,您仍然会看到旧版本