Microsoft Office Tutorials and References
In Depth Information
Copying Chart Sheets to PowerPoint Slides
“Please select a range that has no more than” & vbCrLf & _
“6 columns and/or 20 rows.”, vbCritical, “Range too large”
Exit Sub
End If
‘Declare variables.
Dim ppApp As Object, ppPres As Object, ppSlide As Object
‘Assign the PowerPoint application you are working in to the ppApp variable.
Set ppApp = GetObject(, “Powerpoint.Application”)
‘Assign the presentation file you are working in.
Set ppPres = ppApp.ActivePresentation
Set ppSlide = ppPres.Slides(ppApp.ActiveWindow.Selection.SlideRange.SlideIndex)
‘Copy the range as a picture
rng.CopyPicture Appearance:=xlScreen, Format:=xlPicture
‘Paste the picture of the range onto the slide.
‘Align the range picture to be centered in the slide.
With ppApp.ActiveWindow.Selection.ShapeRange
.Align msoAlignCenters, msoTrue
.Align msoAlignMiddles, msoTrue
End With
‘Release system memory reserved for the Object variables.
Set rng = Nothing
Set ppApp = Nothing
Set ppPres = Nothing
Set ppSlide = Nothing
End Sub
copying cHArT sHEETs To poWErpoinT slidEs
The Try It section of this lesson discusses how to copy an embedded chart into PowerPoint. If you
have a choice between copying embedded charts or chart sheets, choose embedded charts — they
provide you with greater control over how well they can be sized to it a PowerPoint slide. This is
because the ChartObject object is the container for an embedded chart, and it has properties that
you can control for height, width, and location (where you can place it on the worksheet). Charts on
chart sheets do not allow you to control their size.
Sometimes you won’t have a choice, such as when a project calls for chart sheets to be copied
into PowerPoint, and that is what the following macro accomplishes. To take things a step
further, this macro:
Creates a new PowerPoint presentation.
Adds an initial title slide.
Loops through all chart sheets, and with each one, copies its image and pastes it into a new slide.
Places a header title on each slide, then populates it with the chart name and formats the text.
Search JabSto ::

Custom Search