Hello Excel Gurus,
I found the following macro that works extremely well for Excel to PPT coversion:
Sub UsedRangePPT()
Dim objPPT As Object
Dim shtTemp As Object
Dim intSlide As Integer
Set objPPT = CreateObject("Powerpoint.application")
objPPT.Visible = True
objPPT.Presentations.Add
objPPT.ActiveWindow.ViewType = 1 'ppViewSlide
For Each shtTemp In ThisWorkbook.Sheets
shtTemp.Range("A1", shtTemp.UsedRange).CopyPicture xlScreen, xlPicture
intSlide = intSlide + 1
' new slide for each chart
objPPT.ActiveWindow.View.GotoSlide Index:=objPPT.ActivePresentation.Slides.Add(Index:=objPPT.ActivePresentation.Slides.Count + 1, Layout:=12).SlideIndex
objPPT.ActiveWindow.View.Paste
With objPPT.ActiveWindow.View.Slide.Shapes(objPPT.ActiveWindow.View.Slide.Shapes.Count)
.Left = (.Parent.Parent.SlideMaster.Width - .Width) / 2
End With
Next
Set objPPT = Nothing
End Sub
I am using the following:
- MS Excel 2007
- Windows XP
My questions ares:
1. How do I change the above macro to only export a specific range into powerpoint? When I run this macro, it exports all sheets used range?
2. My workbook has 25 sheets but I only want 19 sheets to export. The other 6 sheets are reference or data tabs not for presentation.
3. How do I format each sheet to fit properly onto a slide within the macro or does this need to be handled manually?
Thanks!
I found the following macro that works extremely well for Excel to PPT coversion:
Code:
Dim objPPT As Object
Dim shtTemp As Object
Dim intSlide As Integer
Set objPPT = CreateObject("Powerpoint.application")
objPPT.Visible = True
objPPT.Presentations.Add
objPPT.ActiveWindow.ViewType = 1 'ppViewSlide
For Each shtTemp In ThisWorkbook.Sheets
shtTemp.Range("A1", shtTemp.UsedRange).CopyPicture xlScreen, xlPicture
intSlide = intSlide + 1
' new slide for each chart
objPPT.ActiveWindow.View.GotoSlide Index:=objPPT.ActivePresentation.Slides.Add(Index:=objPPT.ActivePresentation.Slides.Count + 1, Layout:=12).SlideIndex
objPPT.ActiveWindow.View.Paste
With objPPT.ActiveWindow.View.Slide.Shapes(objPPT.ActiveWindow.View.Slide.Shapes.Count)
.Left = (.Parent.Parent.SlideMaster.Width - .Width) / 2
End With
Next
Set objPPT = Nothing
End Sub
Code:
- MS Excel 2007
- Windows XP
My questions ares:
1. How do I change the above macro to only export a specific range into powerpoint? When I run this macro, it exports all sheets used range?
2. My workbook has 25 sheets but I only want 19 sheets to export. The other 6 sheets are reference or data tabs not for presentation.
3. How do I format each sheet to fit properly onto a slide within the macro or does this need to be handled manually?
Thanks!