Consulting

Results 1 to 5 of 5

Thread: Import JPG Into Content Placeholder

  1. #1
    VBAX Newbie
    Joined
    Oct 2013
    Posts
    3
    Location

    Import JPG Into Content Placeholder

    Office 2010
    Window 7 Pro 64bit

    I have a layout which contains a content placeholder. I create a slide with this layout. My goal is to have VBA import a JPG into the content placeholder of the slide. I use a content placeholder rather than a picture placeholder because manually importing a JPG into a content placeholder does not crop while importing into a picture placeholder crops.

    What is the VBA code to import a JPG into the content placeholder of a slide?

    Thanks in advance.
    Last edited by john7; 10-28-2013 at 02:24 PM.

  2. #2
    VBAX Master
    Joined
    Feb 2007
    Posts
    2,094
    Location
    You need to say which version you have because 2007 acts differently to 2010 on.
    John Wilson
    Microsoft PowerPoint MVP
    Amazing Free PowerPoint Tutorials
    http://www.pptalchemy.co.uk/powerpoi...tutorials.html

  3. #3
    VBAX Newbie
    Joined
    Oct 2013
    Posts
    3
    Location
    Office 2010
    Window 7 Pro 64bit

  4. #4
    VBAX Master
    Joined
    Feb 2007
    Posts
    2,094
    Location
    In Office 2010 Images will usually go into empty content placeholders all by themselves.

    Sub AddPic()
    Dim osld As Slide
    Set osld = ActivePresentation.Slides(1) ' change number to suit
    'obviously adjust path to suit your image
    'Left and Top will be ignored but must have a value
    osld.Shapes.AddPicture "C:\Users\John\Desktop\Pic1.jpg", _
    LinkToFile:=msoFalse, _
    SaveWithDocument:=msoTrue, _
    Left:=0, _
    Top:=0
    End Sub
    Note in 2007 this does not work.
    John Wilson
    Microsoft PowerPoint MVP
    Amazing Free PowerPoint Tutorials
    http://www.pptalchemy.co.uk/powerpoi...tutorials.html

  5. #5
    VBAX Newbie
    Joined
    Oct 2013
    Posts
    3
    Location
    This worked.
    Thank you for the explanation.

Posting Permissions

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