title: Refresh protected pivot-table with a button?
body: <p>I have this macro for a button to refresh all the pivot-tables in a worksheet:</p>
  
  <pre><code>Sub Button3_Click()
  ThisWorkbook.RefreshAll
  End Sub
  </code></pre>
  
  <p>And I wanted to add the functionality to refresh all the pivot tables even if they are on a protected sheet. I protected the pivot-table sheet with the password MyPwd and used the below code, but it won't work:</p>
  
  <pre><code>Sub Button3_Click()
  Unprotect Password:="MyPwd"
  ThisWorkbook.RefreshAll
  Protect Password:="MyPwd", _
  DrawingObjects:=True, Contents:=True, _
  Scenarios:=True, AllowUsingPivotTables:=True
  End With
  End Sub
  </code></pre>
  
  <p>Visual Basic is all new to me. What am I doing wrong?</p>