我有以下简单的代码来关闭一系列打开的工作簿。我刚刚切换到Excel 2013,在此新版本中,对于未隐藏的每个工作簿,我的屏幕在Excel中始终闪烁一个白色窗口。
如何使烦人的屏幕闪烁关闭?
Sub CloseFiles()
On Error Resume Next
Application.ScreenUpdating = False
Application.StatusBar = "Please wait while files are closed."
Application.DisplayAlerts = False
Dim rCell As Range
For Each rCell In Range("Files")
Application.StatusBar = "Closing file " & rCell.Value
If rCell.Value <> "" Then
Windows(rCell.Value).Visible = True
Workbooks(rCell.Value).Close SaveChanges:=True
End If
Next rCell
Application.WindowState = xlMaximized
Windows("Filename.xlsm").Activate
Application.DisplayAlerts = True
Application.StatusBar = False
Application.ScreenUpdating = True
End Sub
Run Code Online (Sandbox Code Playgroud)