Consulting

Results 1 to 3 of 3

Thread: Import pictures from a folder to an existing PowerPoint

  1. #1
    VBAX Newbie
    Joined
    Nov 2020
    Posts
    5
    Location

    Lightbulb Import pictures from a folder to an existing PowerPoint

    Hello Everyone,

    I am trying to create a clean presentation from an old one using the master slider (many texts were not recognized as a title or a text placeholder) as I need to change the whole design.

    Thanks to a VBA code, I exported every text contents into a Word document which will be use as a database. (If everything is clean, I understand I can directly copy paste all texts from the outline view).

    In this Word document, I put all the titles in level 1 and descriptions in level 2.

    Then I created a blank presentation using slides from outlines and it works perfectly.

    Now I have about 150 clean slides with no pictures.

    I have already exported all the images by renaming my old presentation to *.zip and I have a media folder with every image named from 1.jpg/jpeg/png to XXX.jpg/jpeg/png

    I would like to import them to the new presentation I have just created (which has titles and text placeholders) in the same order. I need them backward and fitting the whole slide.

    Is there a way to do this using VBA? By the way, I would really love to understand better the VBA for PowerPoint but I see many courses for Excel. What is the "bible" for new learners?

    Thank you very much for your help.

  2. #2
    VBAX Newbie
    Joined
    Nov 2020
    Posts
    5
    Location
    Hello everyone,

    I come back with this code that does almost the same thing that I wanted
    My only issue is that it inserts the pictures in new slides while I need the first picture to go the first slide, second to second, etc ...

    Thank you very much

    Sub PowerPoint_Import()
    Dim ImgI AsLong, tmpDIAPO As Slide
    With Application.FileDialog(msoFileDialogFilePicker)
    .Filters.Add "Images","*.gif; *.jpg; *.jpeg",1
    If.Show =-1Then
    For ImgI =1To.SelectedItems.Count
    Set tmpDIAPO = ActivePresentation.Slides.Add(Index:=ImgI, Layout:=ppLayoutTitleOnly)
    tmpDIAPO.Shapes.AddPicture FileName:=.SelectedItems.Item(ImgI),_
    LinkToFile:=msoFalse,_
    SaveWithDocument:=msoTrue,_
    Left:=0, Top:=0,_
    Width:=-1, Height:=-1
    Next
    EndIf
    EndWith
    EndSub

  3. #3
    VBAX Master
    Joined
    Feb 2007
    Posts
    2,093
    Location
    Maybe
    Sub PowerPoint_Import()
    Dim ImgI AsLong, tmpDIAPO As Slide
    With Application.FileDialog(msoFileDialogFilePicker)
    .Filters.Add "Images","*.gif; *.jpg; *.jpeg",1
    If.Show =-1Then
    For ImgI =1To.SelectedItems.Count
    Set tmpDIAPO = ActivePresentation.Slides(ImgI)
    tmpDIAPO.Shapes.AddPicture FileName:=.SelectedItems.Item(ImgI),_
    LinkToFile:=msoFalse,_
    SaveWithDocument:=msoTrue,_
    Left:=0, Top:=0,_
    Width:=-1, Height:=-1
    Next
    EndIf
    EndWithEndSub
    John Wilson
    Microsoft PowerPoint MVP
    Amazing Free PowerPoint Tutorials
    http://www.pptalchemy.co.uk/powerpoi...tutorials.html

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
  •