Protect Pivot table queries

G

Guest

Hi I need to ensure that users can't edit the queries underlying pivot
tables. I don't want to turn sheet protection on and off as this has caused
problems with corrupting the pivots. I am using the following code and it
just ain't working:

Public Sub ProtectPivots()

Dim ws As Worksheet
Dim QueryTables As QueryTables
Dim Query As QueryTable

For Each ws In ActiveWorkbook.Worksheets
ws.Activate
Range("B8").Activate
For Each Query In ws.QueryTables
Query.EnableEditing = False
Next
Next


End Sub

If anybody can see my blunder I would be really grateful (again!!). Thanks
 
G

Guest

A querytable is completely different from a pivot table.

Look at the PivotTables/PivotCaches.

Perhaps set the EnableRefresh property to false. (pivotcache)
 
G

Guest

Hi Tom - I was afraid of that. I don't think that disabling refresh of the
pivotcache will achieve what I need, but I'll try. Thanks again Tom.

Regards
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top