Paste Excel Data to PPT that will cover the whole slide

VBAWannabee2

New Member
Joined
Feb 23, 2022
Messages
28
Office Version
  1. 2010
Platform
  1. 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!

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
 

Excel Facts

Can Excel fill bagel flavors?
You can teach Excel a new custom list. Type the list in cells, File, Options, Advanced, Edit Custom Lists, Import, OK

Forum statistics

Threads
1,224,823
Messages
6,181,181
Members
453,021
Latest member
Justyna P

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top