Filter automatically a graph from Excel on powerpoint using VBA

ectour

New Member
Joined
Nov 15, 2022
Messages
2
Office Version
  1. 365
Platform
  1. Windows
Hi,

I have more than 100 charts on Powerpoint from the same Excel and I would like to filter them automatically as they should be filtered with the same category.

My code is:

VBA Code:
'Loop through each slide in the presentation
For Each pptSlide In pptPresentation.Slides

    'Loop through each shape in each slide
    For Each pptShape In pptSlide.Shapes
   
        'Find out if the shape is a linked object or a linked picture
        If (pptShape.Type = msoLinkedPicture) Or (pptShape.Type _
        = msoLinkedOLEObject) Or (pptShape.HasChart = msoTrue) Or _
        (pptShape.Type = msoLinkedGraphic) Or (pptShape.Type = msoChart) Then
            
            With pptShape.ChartGroups(1)
                .FullCategoryCollection(1).IsFiltered = True
                .FullCategoryCollection(3).IsFiltered = True
                .FullCategoryCollection(4).IsFiltered = True
                .FullCategoryCollection(5).IsFiltered = True
                .FullCategoryCollection(6).IsFiltered = True
                .FullCategoryCollection(7).IsFiltered = True
                .FullCategoryCollection(8).IsFiltered = True
                .FullCategoryCollection(9).IsFiltered = True
                .FullCategoryCollection(10).IsFiltered = True
                .FullCategoryCollection(11).IsFiltered = True
                .FullCategoryCollection(12).IsFiltered = True
                .FullCategoryCollection(13).IsFiltered = True
                .FullCategoryCollection(14).IsFiltered = True
                
            End With
        End If
    Next
Next

Thanks in advance,

EctorUR
 

Excel Facts

Best way to learn Power Query?
Read M is for (Data) Monkey book by Ken Puls and Miguel Escobar. It is the complete guide to Power Query.

Forum statistics

Threads
1,214,975
Messages
6,122,537
Members
449,088
Latest member
RandomExceller01

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