Question

I am making a PowerPoint Add-in that makes different kind of charts. These charts are made by using PowerPoint.Chart

Upon exploring the Chart object I came across the method Chart.Axes() and the property Chart.HasAxis. PowerPoint interop provides two objects named PowerPoint.Axes and PowerPoint.Axis respectively.

The problem is PowerPoint.Axis object has some methods and properties like MajorGirdlines, LogBase, MaximumScale etc which I need to use in my Add-in but I can't find how to reference these objects to my chart's axes or axis property or what is the difference between PowerPoint.Axis and PowerPoint.Axes.

The Axis Documentation and Axes Documentation at MSDN doesn't help much either.

Was it helpful?

Solution

The Axis documentation you link to above is about Interop, the Axes Documentation is about VBA. The latter also has an Axis object, which has the properties and methods you want to apply. The documentation for that can be found from the link below the title

Represents a collection of all the Axis objects in the specified chart.

So, what you (probably) want is the documentation for the Axis object "Axis Object (PowerPoint)". In there you will find examples for the properties, e.g. the MajorGridlines example goes like this:

With ActiveDocument.InlineShapes(1)
   If .HasChart Then
        With .Chart.Axes(xlValue)
            If .HasMajorGridlines Then
                 ' Set the color to blue.
                .MajorGridlines.Border.ColorIndex = 5 
            End If
        End With
    End If
End With
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top