title: Auto Refresh in Smart View using a Macro
body: <p>I am trying to create a macro that will automatically refresh my data in Smart View.  I need to be able to have it run automatically without opening the file.  I am new to macros and I am not an expert so if someone can help me it would be very much appreciated.  It needs to refresh daily by itself.</p>
  
  <p>This is the code I have</p>
  
  <pre><code>    Sub RefreshWB()
  
  Dim i As Integer
  For i = 1 To Worksheets.Count
      If Sheets(i).Visible Then
          Sheets(i).Select
          Call HypMenuVRefresh
          i = i + 1
          Exit For
          End If
      Next i
  End Sub
  Sub RefreshWS()
    x = HypMenuVRefresh()
  End Sub
  </code></pre>
  
  <p>For some reason the loop to refresh all pages errors out.  I think it has to do with Sheets(i).Select line.  But I need to automate this macros without having to go into the file to run the macros.</p>