Supercharge your PowerPoint productivity with
Supercharge your PPT Productivity with PPTools - Click here to learn more.

Proud member of

PPTools

Image Export converts PowerPoint slides to high-quality images.

PPT2HTML exports HTML even from PowerPoint 2010 and 2013, gives you full control of PowerPoint HTML output, helps meet Section 508 accessibility requirements

Merge Excel data into PowerPoint presentations to create certificates, awards presentations, personalized presentations and more

Resize your presentations quickly and without distortion

Language Selector switches the text in your presentation from one language to another

FixLinks prevents broken links when you distribute PowerPoint presentations

Shape Styles brings styles to PowerPoint. Apply complex formatting with a single click.

Programmatically add an MSGraph chart as a user-defined custom graph type

Problem

PowerPoint (or rather MSGraph) allows a user to manually create and format a graph in a specific style, then add it to a list of user-defined custom graph formats that can be re-used later as though they were MSGraph's own predefined formats.

Transporting these styles from one computer to another is difficult at best; adding my custom styles to your PowerPoint installation would require deleting all of your custom styles. Not good.

But by expanding on the code below, you could add each chart in a presentation to a user's set of custom chart styles, without harming their existing styles in any way.

Solution

This code will add the currently selected graph as a custom graph type:

Sub SaveChartAsAutoformat()

    Dim oGraphChart As Object

    Set oGraphChart = ActiveWindow.Selection.ShapeRange(1).OLEFormat.Object
    With oGraphChart.Application
        ' give it a name and a description:
        Call .AddChartAutoFormat("ChartName", _
            "This is the description of the chart.")

        ' or to remove:
        ' .DeleteChartAutoFormat ("BogusChart")

    End With

End Sub

Search terms:autoformat,custom,chart,msgraph,graph


Did this solve your problem? If so, please consider supporting the PPT FAQ with a small PayPal donation.
Page copy protected against web site content infringement by Copyscape Contents © 1995 - 2022 Stephen Rindsberg, Rindsberg Photography, Inc. and members of the MS PowerPoint MVP team. You may link to this page but any form of unauthorized reproduction of this page's contents is expressly forbidden.

Supercharge your PPT Productivity with PPTools

content authoring & site maintenance by
Friday, the automatic faq maker (logo)
Friday - The Automatic FAQ Maker

Programmatically add an MSGraph chart as a user-defined custom graph type
http://www.pptfaq.com/FAQ00672_Programmatically_add_an_MSGraph_chart_as_a_user-defined_custom_graph_type.htm
Last update 07 June, 2011
Created: