Dashboard publish

tintin1012000

Board Regular
Joined
Apr 27, 2011
Messages
237
Looking for vb to cycle through filters /,slicer in a pivot chart in sheet 1.After each seletion change in sheet 1 i need to publish sheet 2 as a static webpage where the name of the webpage is taken from a cell in sheet 2 which i have linked to the pivor in sheet 1.

So basically i have approx 10 different selections in pivot in sheet 1 which will output a chart /dashboard for each one . I have a main page with links to all 10 webpages for navigation.. we have office13

Anyone help with the vba to change pivot and publish cycles.
I can have a predefined list in sheet 1 if that helps
 

Excel Facts

Who is Mr Spreadsheet?
Author John Walkenbach was Mr Spreadsheet until his retirement in June 2019.
Hello

Are you working with OLAP data? The code below will tell.

I understand changes at Sheet 1 will reflect on Sheet 2, is this correct?

VBA Code:
Sub SSlicerI()
Dim i%, s$, wb As Workbook
Set wb = ActiveWorkbook
s = " "
For i = 1 To wb.SlicerCaches.Count
    If wb.SlicerCaches(i).OLAP Then _
    s = s + " " + wb.SlicerCaches(i).Name + vbLf
Next
MsgBox s, , "Total caches: " + CStr(wb.SlicerCaches.Count)
End Sub
 
Upvote 0
An example:

VBA Code:
Sub publish()
Dim si As SlicerItem, i%, j%
With ActiveWorkbook.SlicerCaches("Slicer_YEAR")
    .ClearManualFilter
    For j = 1 To .SlicerItems.Count
        .ClearManualFilter
        For i = 1 To .SlicerItems.Count
            Select Case j = i
                Case True
                    ' no action
                Case False
                    .SlicerItems(i).Selected = False
            End Select
        Next
        With ActiveWorkbook.PublishObjects.Add(xlSourceSheet, "c:\test\" & _
        CStr(Sheets("sheet2").[f8].Value) & ".htm", "Sheet2", "", xlHtmlStatic, _
        "Slicer-Conn_23998", .SlicerItems(j).Name)
            .publish True
            .AutoRepublish = False
        End With
    Next
End With
End Sub
 
Upvote 0

Forum statistics

Threads
1,214,791
Messages
6,121,611
Members
449,038
Latest member
apwr

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top