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.