Hi, I am using the follwowing code to delete a table style from an excel file:
Set objTS = ActiveWorkbook.TableStyles("MyTableStyle")
If Not objTS Is Nothing Then
objTS.Delete
End If
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.
What additional change should I make to the avoid so that the table style is deleted without an error?
Thanks :)
Edit: 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?