M
Mike Waldron
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
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