• Status: Solved
  • Priority: Low
  • Security: Public
  • Views: 158
  • Last Modified:

How to insert more than 4 Images on one slide on Powerpoint 2016?

Hi Guys,

I am a fashion buyer and I am required to submit my order photos on powerpoint. I know there is an Insert Album Function that inserts a max of 4 images. I want at least 6 images per slide. Is there a VB Script available for that?

Thank you so much!

- Wael
0
Wael Timbaliyah
Asked:
Wael Timbaliyah
  • 3
  • 3
1 Solution
 
Echo_SCommented:
You might check into Shyam Pillai's Image Importer Wizard. http://www.skphub.com/iiw.htm
0
 
Wael TimbaliyahAuthor Commented:
Hi Echo_S,

Tried that but the version is incompatible with 2016 PowerPoint.

I will definitely need a VB script for that.

Thanks for you suggestion though :)

Wael
0
 
Echo_SCommented:
Oh, I didn't realize that. Let me ask Shyam if there's an update.
0
Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

 
Wael TimbaliyahAuthor Commented:
Thanks Echo_S, life saver!
0
 
Echo_SCommented:
Okay, looks like it is indeed compatible with PPT 2016 (32-bit only). It will appear on the Add-ins tab of the Ribbon. I confirmed that it appears there for me in PPT 2016.

Shyam also said he's just getting around to updating it for 64-bit PPT, so if you need that it should be available relatively soon.
0
 
Jamie GarrochPowerPoint Consultant & DeveloperCommented:
I got interrupted whilst writing the VBA script below so sorry for the delayed response. If you still want a script rather than the much more highly featured add-in that Echo recommended, this macro will do what you need for 6 images (or more if you adapt it). Some caveats:

1. You need to create a custom layout in the slide master and name it "Photos". Then add 6 picture placeholders to this new layout.
2. You must not have more than one slide master in the presentation.
3. You set the folder to look for pictures by changing this line:
Const myFolder = "C:\MyPictures"

Open in new window

4. The folder should not have sub folders or any files in it that are not valid image files e.g. JPG, PNG, TIFF etc.
5. To run it, copy the code to a code module in the VBE (Alt+F11 then Insert/Module). Make sure you have a writeable presentation open and the slide selected where you want the news slides to be added after. Then press Alt+F8 and run the InsertPicturesFromFolder macro.
6. I wrote it very quickly so there is no error handling and it will throw errors at you if you do something different to the above!

Here's the full code:

Option Explicit

#Const DevMode = False ' To use IntelliSense, change to True and add a reference to Microsoft Scripting Runtime

Sub InsertPicturesFromFolder()
#If DevMode Then
  Dim oFSO As FileSystemObject
  Dim oFldr As Folder
  Dim oFile As File
#Else
  Dim oFSO As Object
  Dim oFldr As Object
  Dim oFile As Object
#End If
  Dim x As Long
  Dim lFiles As Long
  Dim lFile As Long
  Dim lSlides As Long
  Dim lSlide As Long
  Dim oColSld As New Collection
  Dim oColPH As New Collection
  Dim oColFiles As New Collection
  Dim oSld As Slide
  Dim oPH As Shape
  
  Const myFolder = "C:\MyPictures"
  Const PicsPerSlide = 6
  
  Set oFSO = CreateObject("Scripting.FileSystemObject")
  
  Set oFldr = oFSO.GetFolder(myFolder)
  For Each oFile In oFldr.Files
    oColFiles.Add oFile.Path
  Next
  
  lFiles = oFldr.Files.Count
  lSlides = lFiles / PicsPerSlide + IIf(lFiles / PicsPerSlide > Int(lFiles / PicsPerSlide), 1, 0)
  
  With ActivePresentation
    For x = 1 To lSlides
      oColSld.Add .Slides.AddSlide(ActiveWindow.View.Slide.SlideIndex + x, .Designs(1).SlideMaster.CustomLayouts(GetLayout("Photos").Index))
    Next
  End With
  
  For Each oSld In oColSld
    With oSld
      For Each oPH In .Shapes.Placeholders
        If oPH.Type = msoPlaceholder Then
          If oPH.PlaceholderFormat.Type = ppPlaceholderPicture Then oColPH.Add oPH
        End If
      Next
      For Each oPH In oColPH
        lFile = lFile + 1
        If lFile <= lFiles Then oSld.Shapes.AddPicture oColFiles(lFile), msoFalse, msoTrue, oPH.Left, oPH.Top, oPH.Width, oPH.Height
      Next
      Do While oColPH.Count > 0
        oColPH.Remove (oColPH.Count)
      Loop
    End With
  Next
  
  ' Clean up
  Set oFSO = Nothing
  Set oFldr = Nothing
  Set oFile = Nothing
End Sub

Function GetLayout(LayoutName As String) As CustomLayout
  Dim oCL As CustomLayout
  For Each oCL In ActivePresentation.Designs(1).SlideMaster.CustomLayouts
    If oCL.Name = LayoutName Then Set GetLayout = oCL: Exit Function
  Next
End Function

Open in new window

0
 
Wael TimbaliyahAuthor Commented:
That worked perfectly! Thank you!
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Cloud Class® Course: Microsoft Exchange Server

The MCTS: Microsoft Exchange Server 2010 certification validates your skills in supporting the maintenance and administration of the Exchange servers in an enterprise environment. Learn everything you need to know with this course.

  • 3
  • 3
Tackle projects and never again get stuck behind a technical roadblock.
Join Now