Results 1 to 2 of 2

Thread: Copy and Pasting Picture to PowerPoint
Thanks Thanks: 0 Likes Likes: 0

  1. #1
    New Member
    Join Date
    Jun 2019
    Posts
    17
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default Copy and Pasting Picture to PowerPoint

    Hello hope everyone is doing great!
    So I am trying to copy and paste these pictures with specific "names" onto specific slide onto an existing PowerPoint. Below is the code that I am currently using please let me know if I can expound in anyway. I keep getting an error message on the bold, red and underlined line

    Sub PowerpointCB()
    '
    ' PowerpointCB Macro
    '
    Dim PicName As Variant
    Dim pic As Object
    PicName = "Cinco Bug All Screenshot"


    Const nPos As Integer = 5 ' #slide


    Sheets("Cinco Bugs").Array(PicName).Copy


    Dim sFile


    pre.SaveAs sFileArchiveToday


    Dim obj As PowerPoint.Application


    Set obj = CreateObject("Powerpoint.Application")


    Application.ScreenUpdating = False


    Set pre = obj.Presentations.Open(sFile)


    obj.ActiveWindow.View.GotoSlide nPos


    Set sld = pre.Slides(nPos)


    sld.Shapes(1).Delete


    rng.Copy


    sld.Shapes.PasteSpecial DataType:=2


    Application.CutCopyMode = False


    With pre.PageSetup


    sH = .SlideHeight


    sW = .SlideWidth


    End With


    With obj.ActiveWindow.Selection.ShapeRange


    .Width = 400


    .Height = 400


    .Align msoAlignCenters, True


    .Align msoAlignMiddles, True


    End With


    Application.ScreenUpdating = True


    sFileArchiveToday = "S:\Projects\STV_Plus\2 Project Execution Data\2.2 Work products\2.2.2 Systems Engineering\2.2.2.9 Dashboard\Dashboard\Project Report" & Format(Now(), YYYY.MM.DD) & ".pptx"


    pre.SaveAs sFileToday


    'obj.Quit


    End Sub

  2. #2
    MrExcel MVP
    Join Date
    Mar 2004
    Location
    Canada
    Posts
    18,855
    Post Thanks / Like
    Mentioned
    35 Post(s)
    Tagged
    5 Thread(s)

    Default Re: Copy and Pasting Picture to PowerPoint

    Try...

    Code:
    Sheets("Cinco Bugs").Pictures(PicName).Copy
    Hope this helps!

Some videos you may like

User Tag List

Tags for this Thread

Like this thread? Share it with others

Like this thread? Share it with others

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •