Server ViewableItems Collection Example

The following example ensures that the chart and the PivotTable on the Summary sheet are the only items that will be viewable in Excel Services:

Sub MakeObjectsViewable()

'Clear the ServerViewableItems collection

ActiveWorkbook.ServerViewableItems.DeleteAll

'Make only the pivot table and the chart on Summary sheet viewable With ActiveWorkbook.ServerViewableItems

.Add ActiveWorkbook.Sheets("Summary").PivotTables("PivotTable1") .Add ActiveWorkbook.Sheets("Summary").ChartObjects("Chart 1") End With End Sub

0 0

Post a comment