You wanted all the ranges on one slide?
For each range in its own slide and sized to fit width I used this code. I added Early binding so you can change it back or add the reference or just add the line were I set the Range areas and the slide shape's Width. If Height is set 2nd, the width expands over the page width.
If you wanted to include your rectangle shapes this will do it as well. In fact, we could code it to get the area ranges based on rectangular shapes over the ranges.
Sub CreatePPoint()
'Late Binding
'Dim pPoint As Object 'PowerPoint.Application
'Dim pPres As Object 'PowerPoint.Presentation
'Dim pSlide As Object 'PowerPoint.Slide
'Dim pShape As Object 'PowerPoint.ShapeRange
'Dim pAvg As Object 'PowerPoint.Shape
'Early Binding
'Add Tools > References.. > Microsoft Powerpoint 11.0 Object Library
Dim pPoint As PowerPoint.Application
Dim pPres As PowerPoint.Presentation
Dim pSlide As PowerPoint.Slide
Dim pShape As PowerPoint.ShapeRange
Dim pAvg As PowerPoint.Shape
Dim r As Range, ar
Set r = Range("A2:N20,A23:N39,A42:N58,A61:N77")
'Turn off screen updating
Application.ScreenUpdating = False
'Create a new PowerPoint presentation (and application)
'New PowerPoint.Application
'Late Binding
'Set pPoint = CreateObject("PowerPoint.Application")
'Early Binding
Set pPoint = New PowerPoint.Application
Set pPres = pPoint.Presentations.Add
'Loop through each of the items of the page field
For Each ar In r.Areas
If pPres.Slides.Count = 0 Then
Set pSlide = pPres.Slides.Add(1, 12) 'ppLayoutBlank = 12
Else
Set pSlide = pPres.Slides.Add(pPres.Slides.Count + 1, _
12) 'ppLayoutBlank
End If
'Copy an image of the chart
ar.CopyPicture Appearance:=xlPrinter, Format:=xlPicture
'Paste it in PowerPoint
Set pShape = pSlide.Shapes.Paste
'Resize it
With pShape
Debug.Print "width", .Width, pPres.PageSetup.SlideWidth
.Left = 10
.Top = 10
.Height = pPres.PageSetup.SlideHeight - 20
.Width = pPres.PageSetup.SlideWidth - 20
'.ScaleWidth 1, msoFalse, msoScaleFromTopLeft 'Was 1
'.ScaleHeight 1, msoFalse, msoScaleFromBottomRight 'Was 0.94
End With
Next ar
'Restore screen updating
Application.ScreenUpdating = True
'Activate and display PowerPoint
pPoint.Visible = True
pPoint.ActiveWindow.ViewType = 1 'ppViewSlide = 1
pPoint.Activate
'Destroy the variables
Set pShape = Nothing
Set pSlide = Nothing
Set pPres = Nothing
Set pPoint = Nothing
End Sub
Bookmarks