• Copy excel chart to Word, Powerpoint or outlook

    Home » Forums » AskWoody support » Productivity software by function » MS Excel and spreadsheet help » Copy excel chart to Word, Powerpoint or outlook

    Author
    Topic
    #457893

    I’m trying to figure out the best way to have excel provide a chart export option, such as exporting a chart to power point, word or outlook. I’ve got a method that works for both power point and word but I don’t think these are the best or most effecient ways to do this. Below is what I have so far and any suggestions to improve this or other options that seem to work better would be appreciated. I’m also looking to find the best way to center a chart on the power point slide or word document.

    To export to Power Point.

    Sub Export_2PP()
    Application.ScreenUpdating = False
    C2E = Worksheets(“CC”).Range(“I12″).Value ‘ This is a cell where the chart name is stored (Chart 1)
    ActiveSheet.ChartObjects(C2E).Activate
    ActiveChart.Parent.Copy
    Set Pwr = CreateObject(Class:=”PowerPoint.Application”)
    Pwr.Visible = True
    Pwr.Presentations.Add
    Pwr.ActivePresentation.Slides.Add Index:=1, Layout:=12
    Pwr.ActiveWindow.View.Paste

    ‘ This section attempts to center the chart but I think this could be improved upon.

    With Pwr.ActiveWindow.Selection.ShapeRange
    .Left = 100
    .Top = 60
    .Width = 500
    .Height = 300
    .Width = 500
    End With
    Application.ScreenUpdating = True
    End Sub

    [u]To export to Word document.[/u]

    Sub Export_2Word()
    Application.ScreenUpdating = False
    C2E = Worksheets(“CC”).Range(“I12″).Value
    ActiveSheet.ChartObjects(C2E).Activate
    ActiveChart.Parent.Copy
    Set Wrd = CreateObject(Class:=”Word.Application”)
    Wrd.Visible = True
    Wrd.Documents.Add DocumentType:=wdNewBlankDocument
    Wrd.Selection.Paste

    ‘ This section attempts to center the chart but I think this could be improved upon.

    With Wrd.ActiveWindow.Selection.ShapeRange
    .Left = 100
    .Top = 60
    .Width = 500
    .Height = 300
    .Width = 500
    End With
    Application.ScreenUpdating = True
    End Sub

    The method I was looking at for exporting a chart to outlook doesn’t see to work with a chart object. It only wants to export text or a range of text. Any help on how to export a chart into and email would be appreciated.

    Thanks so much for any help or suggestions to improve this.

    Viewing 1 reply thread
    Author
    Replies
    • #1149456

      You can replace the two lines

      ActiveSheet.ChartObjects(C2E).Activate
      ActiveChart.Parent.Copy

      with

      ActiveSheet.ChartObjects(C2E).Copy

      For PowerPoint, you could use Pwr.ActivePresentation.PageSetup.SlideWidth and Pwr.ActivePresentation.PageSetup.SlideWidth in combination with the width and height of the chart object to center it.

    • #1149458

      Hans,

      Thanks for the suggestions. Is it possible to export and excel chart to and outlook email? I’ve only been able to export text or a range of text.

      • #1149469

        The Outlook object model doesn’t really provide for this. You could save the chart to a file, using the Export method of the Chart object, and add it to the Attachments collection of a mail message.

    Viewing 1 reply thread
    Reply To: Copy excel chart to Word, Powerpoint or outlook

    You can use BBCodes to format your content.
    Your account can't use all available BBCodes, they will be stripped before saving.

    Your information: