thomasuponor
New Member
- Joined
- Sep 13, 2018
- Messages
- 44
- Office Version
- 2016
- Platform
- Windows
Hi, On Excel sheet, I have 2 areas I want to copy to Power Point on 2 different slides.
Current macro works for 1 area but I'm having problem getting it to work with 2 areas.
Also asked here VBA from Excel to Power Point
Current macro works for 1 area but I'm having problem getting it to work with 2 areas.
Also asked here VBA from Excel to Power Point
VBA Code:
Sub copyRangeToPresentation()
' Open New PowerPoint Instance
Set pptApp = CreateObject("PowerPoint.Application")
With pptApp
' Create A New Presentation
Set ppt = .Presentations.Add
' Add A Blank Slide
Set newSlide = ppt.Slides.Add(1, 12) ' ppLayoutBlank = 12
' Copy Range from Active Sheet in Excel
ActiveSheet.Range1("B2:AI26").Copy
ActiveSheet.Range2("AK2:AW26").Copy
' Paste to Powerpoint as an Image
newSlide.Shapes.PasteSpecial DataType:=2 '2 = ppPasteEnhancedMetafile
' Switch to PowerPoint
.Activate
End With
End Sub
Last edited by a moderator: