![]() |
Protect Pivot table queries
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 -- Sharon |
Protect Pivot table queries
A querytable is completely different from a pivot table.
Look at the PivotTables/PivotCaches. Perhaps set the EnableRefresh property to false. (pivotcache) -- Regards, Tom Ogilvy "Sharon" wrote: 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 -- Sharon |
Protect Pivot table queries
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 -- Sharon "Tom Ogilvy" wrote: A querytable is completely different from a pivot table. Look at the PivotTables/PivotCaches. Perhaps set the EnableRefresh property to false. (pivotcache) -- Regards, Tom Ogilvy "Sharon" wrote: 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 -- Sharon |
All times are GMT +1. The time now is 07:27 AM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com