隐藏已打开的工作簿,然后才能对用户可见

我钩到工作簿打开事件像这样:

Private WithEvents App As Application ' For handling events ' Event handler for when THIS workbook is opened. Private Sub Workbook_Open() Set App = Application ' Set App variable so we can add event handlers App.EnableEvents = True ' Set raise events = true. End Sub ' Event handler to handle the event when a new workbook is open (ie. when Raven Viewer exports to a new workbook in excel Private Sub App_WorkbookOpen(ByVal Wb As Workbook) Wb.Windows(1).Visible = False End Sub 

这隐藏了在此电子表格打开时打开的任何工作簿…但是在短暂的时间内,它们对用户是可见的。 有什么办法可以阻止吗?

我正试图阻止当前打开的工作簿失去任何重点。

工作簿不是用VBA打开的。

谢谢。

使用App_WindowActivate似乎对我更好,但我不积极:

 Private Sub App_WindowActivate(ByVal Wb As Workbook, ByVal Wn As Window) If Not Wn Is ThisWorkbook.Windows(1) Then Application.EnableEvents = False Wn.Visible = False ThisWorkbook.Windows(1).Visible = True Application.EnableEvents = True End If End Sub