Results 1 to 2 of 2

Thread: left side of the images are getting trimed how to make images fit

  1. #1

    left side of the images are getting trimed how to make images fit

    used below code to batch import images into new slides
    images appear to be trimmed on left side, is there a way to make them fit without loosing any part of the image

    p.s. i am using this code on a slidemaster with a title and picture

    Sub insertPics()

    Dim strFolder As String ' Full path to folder
    Dim strName As String
    Dim oPres As Presentation
    Dim osld As Slide
    Dim ocust As CustomLayout
    Dim x As Long
    ' Edit this:
    strFolder = "W:\Personal Folders\Saicharan Sirangi\AA scrpits\Email attachments" 'note the last \

    Set oPres = ActivePresentation
    Set osld = oPres.Slides(oPres.Slides.Count)
    Set ocust = osld.CustomLayout

    strName = Dir$(strFolder & "*.PNG")
    While strName <> ""
    With osld.Shapes.AddPicture(strFolder & strName, msoFalse, msoTrue, -1, -1, -1, -1)
    .Line.Visible = True
    .Line.ForeColor.RGB = vbWhite
    End With
    osld.Shapes.Title.TextFrame.TextRange = strName
    strName = Dir()
    If strName <> "" Then
    Set osld = oPres.Slides.AddSlide(oPres.Slides.Count + 1, ocust)
    ActiveWindow.View.GotoSlide osld.SlideIndex
    End If

    End Sub

  2. #2
    VBAX Master
    Feb 2007
    If you are using a Picture Placeholder they will always crop if the aspect ratio of the image is not the same as that of the placeholder. Mabe adjust the size on the master to get the correct aspect ratio.
    John Wilson
    Microsoft PowerPoint MVP
    Amazing Free PowerPoint Tutorials

Tags for this Thread

Posting Permissions

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