VBAWannabee2
New Member
- Joined
- Feb 23, 2022
- Messages
- 28
- Office Version
- 2010
- Platform
- Windows
Hi,
Hope y'all doing well.
Just want to ask how can I turn my code below to paste the excel data and it will cover the whole slide in PPT?
And also, why is my loop always starts at the very last sheet of my workbook? Why does it happen?
Thanks in advance!
Hope y'all doing well.
Just want to ask how can I turn my code below to paste the excel data and it will cover the whole slide in PPT?
And also, why is my loop always starts at the very last sheet of my workbook? Why does it happen?
Thanks in advance!
VBA Code:
Sub CreateNewPres()
Dim ppt As PowerPoint.Application
Dim pres As PowerPoint.Presentation
Dim sh As PowerPoint.ShapeRange
Dim sl As PowerPoint.Slide
Dim ws As Worksheet
Set ppt = GetObject(Class:="Powerpoint.Application")
Set pres = ppt.Presentations("TESTFILE - Copy.pptx")
For Each ws In ActiveWorkbook.Worksheets
If ws.Visible = True Then
Set sl = pres.Slides.Add(3, ppLayoutBlank)
ws.Range("A1:D8").Copy
Set sh = sl.Shapes.PasteSpecial(ppPasteEnhancedMetafile)
'sh.Top = 50
'sh.Left = 50
End If
Next ws
MsgBox "Process done!"
End Sub