title: Unable to delete a pivot table style from excel work book
body: <p>I am using the follwowing code to delete a table style from an excel file:</p>
  
  <pre><code>Set objTS = ActiveWorkbook.TableStyles("MyTableStyle")
  If Not objTS Is Nothing Then
      objTS.Delete
  End If
  </code></pre>
  
  <p>I am able to delete it using a macro on my local excel sheet. However, when the above code is encapsulated in a function in an XLA code on the server, the objTS.Delete line throws an error. </p>
  
  <p>What additional change should I make to the avoid so that the table style is deleted without an error?</p>
  
  <p>Thanks :)</p>
  
  <p><strong>Edit</strong>: I am unable to even delete the pivot table style from the workbook directly (not just programmatically). Can some one please tell me what is causing this?</p>