none
How do I add image to image placeholder RRS feed

  • Question

  • I'm using Office/PPT 2010.

    The image placeholder already exists with name "BlankImage", and the image is located in "strFullPathAndName".

    How do I now add the image to the image placeholder?

    Regards,

    Henny.

    Thursday, September 12, 2013 6:59 PM

Answers

  • Hi,

    According to your description, you want to add a picture which path is “strFullPathAndName” to an existing picture placeholder named “BlankImage”.

    I think AddPicture method of shape can achieve your goal. In addition, AddPicture method has nothing to do with the name of your placeholder. The picture will be prior filled into the placeholder if the placeholder exists.

    I create a picture placeholder in my Slide Master, and write a sample to add a picture to the second slide.

    Sub Test() 
        Dim strFullPathAndName As String
        strFullPathAndName = "C:\Pictures\images2.jpg"
        Dim pre As Presentation
        Dim sld As Slide
        Set pre = ActivePresentation
        Set sld = pre.Slides(2)
        sld.Shapes.AddPicture strFullPathAndName, msoCTrue, msoCTrue, 0, 0
    End Sub

    There is also a link may help you. The code in the reply of Calvin_Gao is about how to add several pictures to several placeholder.

    Powerpoint Shapes.AddPicture() doesn't take selected placeholder into account

    Saturday, September 14, 2013 3:22 AM

All replies

  • Hi,

    According to your description, you want to add a picture which path is “strFullPathAndName” to an existing picture placeholder named “BlankImage”.

    I think AddPicture method of shape can achieve your goal. In addition, AddPicture method has nothing to do with the name of your placeholder. The picture will be prior filled into the placeholder if the placeholder exists.

    I create a picture placeholder in my Slide Master, and write a sample to add a picture to the second slide.

    Sub Test() 
        Dim strFullPathAndName As String
        strFullPathAndName = "C:\Pictures\images2.jpg"
        Dim pre As Presentation
        Dim sld As Slide
        Set pre = ActivePresentation
        Set sld = pre.Slides(2)
        sld.Shapes.AddPicture strFullPathAndName, msoCTrue, msoCTrue, 0, 0
    End Sub

    There is also a link may help you. The code in the reply of Calvin_Gao is about how to add several pictures to several placeholder.

    Powerpoint Shapes.AddPicture() doesn't take selected placeholder into account

    Saturday, September 14, 2013 3:22 AM
  • If I have multiple picture placeholders in a slide, how does it differentiate which one to add the picture to then?
    • Edited by HennyT Monday, September 16, 2013 3:09 PM
    Monday, September 16, 2013 3:09 PM
  • Hi,

    I think it may depend on the sort of adding the placeholders. You may refer to the link I shared in the first reply.

    Tuesday, September 17, 2013 2:08 AM