Prefix My code opens an external book with an internal database with some information that should not be visible to the entire organization. I can open an external workbook and get all the data from PivotTable
successfully.
Problem . When my code runs, the screen flickers for ~ 0.5 seconds to show another book.
Purpose : Do not have flickering on the screen when switching between books.
My code (corresponding section):
Option Explicit Public Sub GetBudgetData_fromPivotTable(Budget_ShtName As String, Budget_PvtName As String) Dim BudgetWB As Workbook Dim PvtTbl As PivotTable Dim pvtFld As PivotField Dim strPvtFld As String Dim prjName As String ' ****** This is the Section I am trying to prevent from the screen to flicker ****** Application.ScreenUpdating = False Application.DisplayAlerts = False ' read budget file parameters Set BudgetWB = Workbooks.Open(BudgetFile_Folder & BudgetFile_wbName) BudgetWB.Windows(1).Visible = False OriginalWB.Activate ' <-- this is the original workbook that is calling the routine Set PvtTbl = BudgetWB.Worksheets(Budget_ShtName).PivotTables(Budget_PvtName) ' a lot of un-relevant code line BudgetWB.Close (False) ' close budget file OriginalWB.Activate ' restore settings Application.ScreenUpdating = True Application.DisplayAlerts = True End Sub
source share