title: Cannot Bypass Error 619 "Control not found"
body: <p>I have the following code and it appears to always produce an error 619 &quot;Control not found&quot; at line <code>session.findById(&quot;wnd[1]/tbar[0]/btn[0]&quot;).press</code>, even though I have entered <code>Application.DisplayAlerts = False</code> and I've taken extra precaution to bypass the error. I have attempted using <code>On Error GoTo</code>, <code>On Error Resume Next</code>, and even <code>If IsError()</code>, but none of that seems to be working.</p>
  <pre><code>'Insert Sum of Amts and list as Balance on Summary tab
  Sheets(2).Select
      LastRow = ActiveSheet.UsedRange.Rows.Count
      Range(&quot;D&quot; &amp; LastRow + 1).Select
      ActiveCell.FormulaR1C1 = &quot;=SUM(R2C4:R&quot; &amp; LastRow &amp; &quot;C4)&quot;
      Columns(&quot;D:D&quot;).Select
      Selection.NumberFormat = &quot;_(* #,##0.00_);_(* (#,##0.00);_(* &quot;&quot;-&quot;&quot;??_);_(@_)&quot;
  Sheets(1).Select
      Range(&quot;C7&quot;).Select
      ActiveCell.FormulaR1C1 = &quot;=Statement!R&quot; &amp; LastRow + 1 &amp; &quot;C4&quot;
  
  'Insert V-lookup for open items
  Sheets(2).Select
      Range(&quot;G2&quot;).Select
     ActiveCell.FormulaR1C1 = _
          &quot;=IF(OR(RC[-1]=&quot;&quot;R&quot;&quot;,RC[-1]=&quot;&quot;A&quot;&quot;),&quot;&quot;-&quot;&quot;,IF(IFERROR(VLOOKUP(RC[-5],'FBL1N Scheduled'!C1:C2,2,0), &quot;&quot;-&quot;&quot;)&gt;TODAY(),IFERROR(VLOOKUP(RC[-5],'FBL1N Scheduled'!C1:C2,2,0), &quot;&quot;-&quot;&quot;),IF(IFERROR(VLOOKUP(RC[-5],'FBL1N Scheduled'!C1:C2,2,0), &quot;&quot;-&quot;&quot;)&lt;=DATE(YEAR(TODAY()),MONTH(TODAY()),15),IF(TODAY()&lt;=DATE(YEAR(TODAY()),MONTH(TODAY()),15),DATE(YEAR(TODAY()),MONTH(TODAY()),15),EOMONTH(TODAY(),0)))))&quot;
      Range(&quot;G2&quot;).Select
      Selection.AutoFill Destination:=Range(&quot;G2:G&quot; &amp; LastRow), Type:=xlFillDefault
      Range(&quot;G2:G&quot; &amp; LastRow).Select
      Selection.NumberFormat = &quot;mm/dd/yyyy;@&quot;
  
  'Insert V-lookup for cleared items
      Range(&quot;H2&quot;).Select
      ActiveCell.FormulaR1C1 = _
          &quot;=IF(RC[-1]&lt;&gt;&quot;&quot;-&quot;&quot;,&quot;&quot;-&quot;&quot;,IFERROR(VLOOKUP(RC[-6],'FBL1N Paid'!C1:C2,2,0),&quot;&quot;-&quot;&quot;))&quot;
      Range(&quot;H2&quot;).Select
      Selection.AutoFill Destination:=Range(&quot;H2:H&quot; &amp; LastRow), Type:=xlFillDefault
      Range(&quot;H2:H&quot; &amp; LastRow).Select
      Selection.NumberFormat = &quot;mm/dd/yyyy;@&quot;
      
              'Autofit and filter
              Cells.Select
              Cells.EntireColumn.AutoFit
              Application.CutCopyMode = False
              Selection.AutoFilter
             
      'Copy values for Vim
      LastRow = ActiveSheet.UsedRange.Rows.Count
      ActiveSheet.Range(&quot;$A$1:$K$&quot; &amp; LastRow).AutoFilter Field:=7, Criteria1:=&quot;-&quot;
      ActiveSheet.Range(&quot;$A$1:$K$&quot; &amp; LastRow).AutoFilter Field:=8, Criteria1:=&quot;-&quot;
          'Insert DPN for processing/obsolete invoices
          With Worksheets(&quot;Statement&quot;).AutoFilter.Range
            Range(&quot;E&quot; &amp; .Offset(1, 0).SpecialCells(xlCellTypeVisible)(1).Row).Select
          End With
          ActiveCell.FormulaR1C1 = _
          &quot;=IFERROR(VLOOKUP(RC[-3],'VIM Export'!C1:C5,3,0),&quot;&quot;&quot;&quot;)&quot;
          'Copy down in only visible
          With ActiveSheet.UsedRange
              .Resize(.Rows.Count - 1).Offset(1).Columns(&quot;E&quot;). _
                 SpecialCells(xlCellTypeVisible).FillDown
          End With
      
          'Select Reference #
          With Worksheets(&quot;Statement&quot;).AutoFilter.Range
            Range(&quot;B&quot; &amp; .Offset(1, 0).SpecialCells(xlCellTypeVisible)(1).Row).Select
          End With
          
          'If none are left processing, skip VIM
          If ActiveCell.Value = &quot;&quot; Then GoTo Valuations:
          
      'Copy all invoice numbers not posted
      Range(ActiveCell, ActiveCell.End(xlDown)).Select
      Application.CutCopyMode = False
      Selection.Copy
  
  'Switch to Summary page to pull vendor data in VIM search
  Sheets(1).Select
  
  'Execute in SAP
  If Not IsObject(SAPApp) Then
     Set SapGuiAuto = GetObject(&quot;SAPGUI&quot;)
     Set SAPApp = SapGuiAuto.GetScriptingEngine
  End If
  If Not IsObject(Connection) Then
     Set Connection = SAPApp.Children(0)
  End If
  If Not IsObject(session) Then
     Set session = Connection.Children(0)
  End If
  If IsObject(WScript) Then
     WScript.ConnectObject session, &quot;on&quot;
     WScript.ConnectObject SAPApp, &quot;on&quot;
  End If
  
  'Open Vim and apply parameters (inserting Doc Numbers)
  session.findById(&quot;wnd[0]/tbar[0]/btn[12]&quot;).press
  session.findById(&quot;wnd[0]/tbar[0]/btn[12]&quot;).press
  't-code entered in bar
  session.findById(&quot;wnd[0]/tbar[0]/okcd&quot;).Text = &quot;/n/opt/vim_analytics&quot;
  session.findById(&quot;wnd[0]&quot;).sendVKey 0
  session.findById(&quot;wnd[0]/usr/btn%_S_XBLNR_%_APP_%-VALU_PUSH&quot;).press
  session.findById(&quot;wnd[1]/tbar[0]/btn[24]&quot;).press
  session.findById(&quot;wnd[1]&quot;).sendVKey 8
  session.findById(&quot;wnd[0]/usr/btn%_S_LIFNR_%_APP_%-VALU_PUSH&quot;).press
  session.findById(&quot;wnd[1]/usr/tabsTAB_STRIP/tabpSIVA/ssubSCREEN_HEADER:SAPLALDB:3010/tblSAPLALDBSINGLE/ctxtRSCSEL_255-SLOW_I[1,0]&quot;).Text = Cells(3, 1).Value
  session.findById(&quot;wnd[1]/usr/tabsTAB_STRIP/tabpSIVA/ssubSCREEN_HEADER:SAPLALDB:3010/tblSAPLALDBSINGLE/ctxtRSCSEL_255-SLOW_I[1,1]&quot;).Text = Cells(4, 1).Value
  session.findById(&quot;wnd[1]/usr/tabsTAB_STRIP/tabpSIVA/ssubSCREEN_HEADER:SAPLALDB:3010/tblSAPLALDBSINGLE/ctxtRSCSEL_255-SLOW_I[1,2]&quot;).Text = Cells(5, 1).Value
  session.findById(&quot;wnd[1]/usr/tabsTAB_STRIP/tabpSIVA/ssubSCREEN_HEADER:SAPLALDB:3010/tblSAPLALDBSINGLE/ctxtRSCSEL_255-SLOW_I[1,3]&quot;).Text = Cells(3, 3).Value
  session.findById(&quot;wnd[1]/usr/tabsTAB_STRIP/tabpSIVA/ssubSCREEN_HEADER:SAPLALDB:3010/tblSAPLALDBSINGLE/ctxtRSCSEL_255-SLOW_I[1,4]&quot;).Text = Cells(4, 3).Value
  session.findById(&quot;wnd[1]/usr/tabsTAB_STRIP/tabpSIVA/ssubSCREEN_HEADER:SAPLALDB:3010/tblSAPLALDBSINGLE/ctxtRSCSEL_255-SLOW_I[1,5]&quot;).Text = Cells(5, 3).Value
  session.findById(&quot;wnd[1]/usr/tabsTAB_STRIP/tabpSIVA/ssubSCREEN_HEADER:SAPLALDB:3010/tblSAPLALDBSINGLE/ctxtRSCSEL_255-SLOW_I[1,1]&quot;).SetFocus
  session.findById(&quot;wnd[1]/usr/tabsTAB_STRIP/tabpSIVA/ssubSCREEN_HEADER:SAPLALDB:3010/tblSAPLALDBSINGLE/ctxtRSCSEL_255-SLOW_I[1,1]&quot;).caretPosition = 7
  session.findById(&quot;wnd[1]&quot;).sendVKey 8
  session.findById(&quot;wnd[0]&quot;).sendVKey 8
  
  On Error Resume Next
  session.findById(&quot;wnd[1]/tbar[0]/btn[0]&quot;).press
  If Err.Number = 0 Then
  
      'Export to Excel (Existing XXL Format)
      session.findById(&quot;wnd[0]/usr/cntlCL_GRID/shellcont/shell&quot;).contextMenu
      session.findById(&quot;wnd[0]/usr/cntlCL_GRID/shellcont/shell&quot;).selectContextMenuItem &quot;&amp;XXL&quot;
      session.findById(&quot;wnd[1]/tbar[0]/btn[0]&quot;).press
      session.findById(&quot;wnd[1]/tbar[0]/btn[0]&quot;).press
      session.findById(&quot;wnd[1]/tbar[0]/btn[0]&quot;).press
      session.findById(&quot;wnd[1]/tbar[0]/btn[0]&quot;).press
      
      'Select Export and Paste into Workbook
          Range(&quot;A1&quot;).Select
          Range(Selection, Selection.End(xlDown)).Select
          Range(Selection, Selection.End(xlToRight)).Select
          Selection.Cut
          Windows(&quot;Updated Auto Recon.xlsm&quot;).Activate
          Sheets(5).Select
          Range(&quot;A1&quot;).Select
          ActiveSheet.Paste
          'Clear Formatting
          ThisWorkbook.ActiveSheet.Cells.ClearFormats
          'Close temporary export sheet
          Windows(&quot;Worksheet in Basis (1)&quot;).Activate
          ActiveWindow.Close
          
      If Not IsObject(SAPApp) Then
         Set SapGuiAuto = GetObject(&quot;SAPGUI&quot;)
         Set SAPApp = SapGuiAuto.GetScriptingEngine
      End If
      If Not IsObject(Connection) Then
         Set Connection = SAPApp.Children(0)
      End If
      If Not IsObject(session) Then
         Set session = Connection.Children(0)
      End If
      If IsObject(WScript) Then
         WScript.ConnectObject session, &quot;on&quot;
         WScript.ConnectObject SAPApp, &quot;on&quot;
      End If
      session.findById(&quot;wnd[1]/tbar[0]/btn[0]&quot;).press
          
      'Formatting VIM Export
      ''Moves columns to the appropriate postions in the worksheet
      ''Move Reference to Column A; Move CoCode to Column B; Move Doc. ID to Column C; Move Document Status to Column D
          Range(&quot;A1&quot;).End(xlToRight).Select
          LastColumn = ActiveCell.Column
          
          For i = 1 To LastColumn
              Cells(1, i).Select
                  If ActiveCell.Value = &quot;CoCd&quot; Then
                      ActiveCell.Value = &quot;CoCode&quot;
                  ElseIf ActiveCell.Value = &quot;Company Code&quot; Then
                      ActiveCell.Value = &quot;CoCode&quot;
                  ElseIf ActiveCell.Value = &quot;DocumentStatus&quot; Then
                      ActiveCell.Value = &quot;Document Status&quot;
                  ElseIf ActiveCell.Value = &quot;DOC Status&quot; Then
                      ActiveCell.Value = &quot;Document Status&quot;
                  ElseIf ActiveCell.Value = &quot;DOC status&quot; Then
                      ActiveCell.Value = &quot;Document Status&quot;
                  ElseIf ActiveCell.Value = &quot;Document Id&quot; Then
                      ActiveCell.Value = &quot;Doc. Id&quot;
                  ElseIf ActiveCell.Value = &quot;Vendor Nam&quot; Then
                      ActiveCell.Value = &quot;Vendor Name&quot;
                  Else
                  End If
          Next i
              
          For i = 1 To LastColumn
              Cells(1, i).Select
              If ActiveCell.Value = &quot;Reference&quot; Then
                  If ActiveCell.Column &lt;&gt; 1 Then
                      Columns(i).Select
                      Selection.Cut
                      Columns(&quot;A&quot;).Insert Shift:=xlToRight
                  Else
                  End If
              Else
              End If
          Next i
          
          For i = 1 To LastColumn
              Cells(1, i).Select
              If ActiveCell.Value = &quot;CoCode&quot; Then
                  If ActiveCell.Column &lt;&gt; 2 Then
                      Columns(i).Select
                      Selection.Cut
                      Columns(&quot;B&quot;).Insert Shift:=xlToRight
                  Else
                  End If
              Else
              End If
          Next i
          
          For i = 1 To LastColumn
              Cells(1, i).Select
              If ActiveCell.Value = &quot;Doc. Id&quot; Then
                  If ActiveCell.Column &lt;&gt; 3 Then
                      Columns(i).Select
                      Selection.Cut
                      Columns(&quot;C&quot;).Insert Shift:=xlToRight
                  Else
                  End If
              Else
              End If
          Next i
          
          For i = 1 To LastColumn
              Cells(1, i).Select
              If ActiveCell.Value = &quot;Document Status&quot; Then
                  If ActiveCell.Column &lt;&gt; 4 Then
                      Columns(i).Select
                      Selection.Cut
                      Columns(&quot;D&quot;).Insert Shift:=xlToRight
                  Else
                  End If
              Else
              End If
          Next i
             
          For i = 1 To LastColumn
              Cells(1, i).Select
              If ActiveCell.Value = &quot;Vendor&quot; Then
                  If ActiveCell.Column &lt;&gt; 5 Then
                      Columns(i).Select
                      Selection.Cut
                      Columns(&quot;E&quot;).Insert Shift:=xlToRight
                  Else
                  End If
              Else
              End If
          Next i
          
          For i = 1 To LastColumn
              Cells(1, i).Select
              If ActiveCell.Value = &quot;Vendor Name&quot; Then
                  If ActiveCell.Column &lt;&gt; 6 Then
                      Columns(i).Select
                      Selection.Cut
                      Columns(&quot;F&quot;).Insert Shift:=xlToRight
                  Else
                  End If
              Else
              End If
          Next i
          
          'Remove Confirmed Duplicate Status
          i = Application.WorksheetFunction.CountIf(Columns(&quot;D:D&quot;), &quot;Confirmed Duplicate&quot;)
          
          If i &gt; 0 Then
              LastRow = ActiveSheet.UsedRange.Rows.Count
              Range(Cells(1, 1), Cells(LastRow, LastColumn)).Select
              Selection.AutoFilter
              ActiveSheet.Range(Cells(1, 1), Cells(LastRow, LastColumn)).AutoFilter Field:=4, Criteria1:=&quot;Confirmed Duplicate&quot;, _
                  Operator:=xlAnd
                  Rows(&quot;2:&quot; &amp; LastRow).SpecialCells(xlCellTypeVisible).Select
                  Selection.Delete Shift:=xlToLeft
                  ActiveSheet.ShowAllData
              Else
          End If
          
          'Remove Cancelled Status
          i = Application.WorksheetFunction.CountIf(Columns(&quot;D:D&quot;), &quot;Cancelled&quot;)
          
          If i &gt; 0 Then
              LastRow = ActiveSheet.UsedRange.Rows.Count
              Range(Cells(1, 1), Cells(LastRow, LastColumn)).Select
              Selection.AutoFilter
              ActiveSheet.Range(Cells(1, 1), Cells(LastRow, LastColumn)).AutoFilter Field:=4, Criteria1:=&quot;Cancelled&quot;, _
                  Operator:=xlAnd
                  Rows(&quot;2:&quot; &amp; LastRow).SpecialCells(xlCellTypeVisible).Select
                  Selection.Delete Shift:=xlToLeft
                  ActiveSheet.ShowAllData
              Else
          End If
                  
          Application.ScreenUpdating = True
          Application.ScreenUpdating = False
          'Force Doc Id to convert to number
          Range(&quot;C:C&quot;).Select
              With Selection
                  Selection.NumberFormat = &quot;General&quot;
                  .Value = .Value
              End With
          
          Application.ScreenUpdating = True
          Application.ScreenUpdating = False
          'Force Vendor # to convert to number
          Range(&quot;E:E&quot;).Select
              With Selection
                  Selection.NumberFormat = &quot;General&quot;
                  .Value = .Value
              End With
          'Sorts Reference number by most recent document status
          LastRow = ActiveSheet.UsedRange.Rows.Count
          Range(Cells(1, 1), Cells(LastRow, LastColumn)).Select
          Range(&quot;A2&quot;).Activate
          ActiveWorkbook.Worksheets(&quot;VIM Export&quot;).Sort.SortFields.Clear
          ActiveWorkbook.Worksheets(&quot;VIM Export&quot;).Sort.SortFields.Add Key:=Range( _
              &quot;C2:C&quot; &amp; LastRow), SortOn:=xlSortOnValues, Order:=xlDescending, DataOption:= _
              xlSortNormal
          ActiveWorkbook.Worksheets(&quot;VIM Export&quot;).Sort.SortFields.Add Key:=Range( _
              &quot;A2:A&quot; &amp; LastRow), SortOn:=xlSortOnValues, Order:=xlAscending, DataOption:= _
              xlSortNormal
          With ActiveWorkbook.Worksheets(&quot;VIM Export&quot;).Sort
              .SetRange Range(Cells(1, 1), Cells(LastRow, LastColumn))
              .Header = xlYes
              .MatchCase = False
              .Orientation = xlTopToBottom
              .SortMethod = xlPinYin
              .Apply
          End With
      
          Range(&quot;A2&quot;).Select
  Else
      Err.Clear
  End If
  On Error GoTo 0
  
  'Resume
  Valuations:
  
  'Select Statement sheet
  Sheets(2).Select
  
  'Clear Filter
  ActiveSheet.ShowAllData
  
      Application.ScreenUpdating = True
      Application.ScreenUpdating = False
     'Change Font and Size, autofit
              Cells.Select
              With Selection.Font
                  .Name = &quot;CotySans&quot;
                  .FontStyle = &quot;Regular&quot;
                  .Size = 9
                  .Strikethrough = False
                  .Superscript = False
                  .Subscript = False
                  .OutlineFont = False
                  .Shadow = False
                  .Underline = xlUnderlineStyleNone
                  .ColorIndex = xlAutomatic
                  .TintAndShade = 0
                  .ThemeFont = xlThemeFontNone
              End With
          'Format Top Row
              Rows(&quot;1:1&quot;).SpecialCells(xlCellTypeConstants).Select
                  Selection.Font.Bold = True
                  With Selection.Interior
                      .Pattern = xlSolid
                      .PatternColorIndex = xlAutomatic
                      .ThemeColor = xlThemeColorDark1
                      .TintAndShade = -0.149998474074526
                      .PatternTintAndShade = 0
                  End With
  
  'Insert Company Code from all tabs
  LastRow = ActiveSheet.UsedRange.Rows.Count
      Range(&quot;A2&quot;).Select
      ActiveCell.FormulaR1C1 = _
          &quot;=IFERROR(VLOOKUP(RC[1],'FBL1N Scheduled'!C1:C4,3,0), IFERROR(VLOOKUP(RC[1],'FBL1N Paid'!C1:C4,3,0),IFERROR(VLOOKUP(RC[1],'VIM Export'!C1:C5,2,0),&quot;&quot;&quot;&quot;)))&quot;
      Selection.AutoFill Destination:=Range(&quot;A2:A&quot; &amp; LastRow - 1)
  
  'Insert Vendor Number from all tabs
  Columns(&quot;B:B&quot;).Select
      Selection.Insert Shift:=xlToRight, CopyOrigin:=xlFormatFromLeftOrAbove
      Range(&quot;B1&quot;).Select
      ActiveCell.FormulaR1C1 = &quot;Vendor #&quot;
      Range(&quot;B2&quot;).Select
      ActiveCell.FormulaR1C1 = _
          &quot;=IFERROR(VLOOKUP(RC[1],'FBL1N Scheduled'!C1:C4,4,0), IFERROR(VLOOKUP(RC[1],'FBL1N Paid'!C1:C4,4,0),IFERROR(VLOOKUP(RC[1],'VIM Export'!C1:C5,5,0),&quot;&quot;&quot;&quot;)))&quot;
      Selection.AutoFill Destination:=Range(&quot;B2:B&quot; &amp; LastRow - 1)
  
  'Pull Block Marker
  Range(&quot;F2&quot;).Select
      ActiveCell.FormulaR1C1 = _
          &quot;=IFERROR(VLOOKUP(RC[-3],'VIM Export'!C1:C5,3,0),&quot;&quot;&quot;&quot;)&quot;
      Range(&quot;F2&quot;).Select
      Selection.AutoFill Destination:=Range(&quot;F2:F&quot; &amp; LastRow)
      Range(&quot;F:F&quot;).Select
          Selection.Copy
              Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
          :=False, Transpose:=False
          
  'Insert VIM Status for processing/obsolete invoices
      Range(&quot;L2&quot;).Select
          ActiveCell.FormulaR1C1 = _
          &quot;=IFERROR(VLOOKUP(RC[-9],'VIM Export'!C1:C5,4,0),&quot;&quot;&quot;&quot;)&quot;
  'Copy down in only visible
      Selection.Copy
      Range(&quot;L&quot; &amp; LastRow - 1).Select
      Range(Selection, Selection.End(xlUp)).Select
      ActiveSheet.Paste
      
  'Insert Status based on VIM Status
      LastRow = ActiveSheet.UsedRange.Rows.Count - 1
      Range(&quot;J2&quot;).Select
      ActiveCell.FormulaR1C1 = _
          &quot;=IF(OR(RC[-3]=&quot;&quot;R&quot;&quot;,RC[-3]=&quot;&quot;A&quot;&quot;),&quot;&quot;Blocked&quot;&quot;,IF(RC[-8]=&quot;&quot;&quot;&quot;,&quot;&quot;Need Copy&quot;&quot;,IF(RC[2]=&quot;&quot;&quot;&quot;,&quot;&quot;&quot;&quot;,IF(RC[2]=&quot;&quot;Return To Vendor&quot;&quot;,&quot;&quot;Return To Vendor&quot;&quot;,IF(RC[2]=&quot;&quot;Obsolete&quot;&quot;,&quot;&quot;Obsolete&quot;&quot;,&quot;&quot;Processing&quot;&quot;)))))&quot;
          Selection.AutoFill Destination:=Range(&quot;J2:J&quot; &amp; LastRow)
          
          'Paste special over formulas
          Range(&quot;A:A&quot;).Select
          Selection.Copy
              Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
          :=False, Transpose:=False
           Range(&quot;B:B&quot;).Select
          Selection.Copy
              Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
          :=False, Transpose:=False
          Range(&quot;F:F&quot;).Select
          Selection.Copy
              Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
          :=False, Transpose:=False
          Range(&quot;H:J&quot;).Select
          Selection.Copy
              Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
          :=False, Transpose:=False
          Application.CutCopyMode = False
  
      Application.ScreenUpdating = True
      Application.ScreenUpdating = False
              'AutoFit Columns
              Cells.Select
              Cells.EntireColumn.AutoFit
              Application.CutCopyMode = False
          Range(&quot;L:L&quot;).Value = &quot;&quot;
          LastRow = ActiveSheet.UsedRange.Rows.Count - 1
          Range(&quot;B2:C&quot; &amp; LastRow).Select
          With Selection
              .HorizontalAlignment = xlRight
              .VerticalAlignment = xlBottom
              .WrapText = False
              .Orientation = 0
              .AddIndent = False
              .IndentLevel = 0
              .ShrinkToFit = False
              .ReadingOrder = xlContext
              .MergeCells = False
          End With
          With Selection
              .HorizontalAlignment = xlLeft
              .VerticalAlignment = xlBottom
              .WrapText = False
              .Orientation = 0
              .AddIndent = False
              .IndentLevel = 0
              .ShrinkToFit = False
              .ReadingOrder = xlContext
              .MergeCells = False
          End With
          Range(&quot;A2&quot;).Select
          
      'Refresh Pivot Info for dates
      Worksheets(&quot;Pivots&quot;).PivotTables(&quot;PivotTable1&quot;).PivotCache.Refresh
      Worksheets(&quot;Pivots&quot;).PivotTables(&quot;PivotTable2&quot;).PivotCache.Refresh
    
      'Hide Data Tabs
      ThisWorkbook.Sheets(Array(3, 4, 5)).Visible = False
                 
      Sheets(1).Select
                 
    'Saves the file
      Dim VN As String
          VN = Range(&quot;A3&quot;).Value
      Dim VName As String
          VName = Range(&quot;B3&quot;).Value
  
              Set objWS = CreateObject(&quot;WScript.Shell&quot;)
              strDesktopPath = objWS.SpecialFolders(&quot;Desktop&quot;)
              ActiveWorkbook.SaveAs strDesktopPath &amp; &quot;\&quot; &amp; VN &amp; &quot;.&quot; &amp; VName &amp; &quot; as of &quot; &amp; Format(Now, &quot;mm.dd.yyyy&quot;) &amp; &quot;.xlsm&quot;
  
  'Update final once macro completes
  Application.ScreenUpdating = True
  
  Application.DisplayAlerts = True
  
  End Sub
  </code></pre>