ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Charts to Word (https://www.excelbanter.com/excel-programming/280252-charts-word.html)

Mike Waldron[_2_]

Charts to Word
 
Ian,

I've never moved charts to Word but this code works for
PowerPoint and I would assume a small modification would
do.

Mike

Sub ToPowerPoint()
' copies and paste all charts in the active workbook to
PowerPoint
'=================================
chtcnt = Charts.Count

Dim pp As Object
On Error Resume Next
Set pp = GetObject(, "PowerPoint.Application")
If Err.Number < 0 Then
Err.Clear
Set pp = CreateObject("PowerPoint.Application")
End If
pp.Visible = True
pp.Presentations.Add

For i = 1 To chtcnt
Charts(i).Activate
ActiveChart.ChartArea.Select
ActiveChart.ChartArea.Copy

With pp.ActivePresentation
.Slides.Add i, ppLayoutBlank
.Slides(i).Shapes.Paste
With .Slides(i).Shapes(1)
.Top = 75
.Left = 5
.Height = 350
End With
End With
Next i
End Sub



All times are GMT +1. The time now is 10:06 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com