How do I exclude rows in a charts dataset in vba?

G

Guest

I have some vba in powerpoint which populates a datasheet within a slide. I
only want some of the rows of this datasheet to appear in the chart.

If I double click the rows to exclude them before populating the sheet they
just reappear once the sheet is populated. I'm trying to find the code to
exclude the rows after I've populated.
 
S

Shyam Pillai

Ross,

Here is sample code which excludes the 1st row of the chart data. I've
assumed that 1st shape on the 1st slide of the active presentation is a
MSGraph object.
' =========================================================
Dim oChart As Graph.Chart
Dim oDataSheet As Graph.DataSheet
Set oChart = ActivePresentation.Slides(1).Shapes(1).OLEFormat.Object
Set oDataSheet = oChart.Application.DataSheet

oDataSheet.Rows(1).Include = False

oChart.Application.Update
oChart.Application.Quit
Set oDataSheet = Nothing
Set oChart = Nothing
' =========================================================
 

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