I would like to insert every 6 pictures in a new slide of powerpoint with it's file name at the centre bottom of the image itself.
The below coding works for word but not on powerpoint and i would like to do further editing.
1) modify coding so it'll work on powerpoint as well
2) current in word it's showing 1 image per page, can we modify to show 6 images per slide when it comes to powerpoint?
3) the file name in word currently showing the format of the file e.g. jpg / .png, how could i skip that?
4) the file name is showing on the bottom left in word, how can i make it centre bottom?
Sub PicWithCaption()
Dim xFileDialog As FileDialog
Dim xPath, xFile As Variant
On Error Resume Next
Set xFileDialog = Application.FileDialog(msoFileDialogFolderPicker)
If xFileDialog.Show = -1 Then
xPath = xFileDialog.SelectedItems.Item(1)
If xPath <> "" Then
xFile = Dir(xPath & "\*.*")
Do While xFile <> ""
If UCase(Right(xFile, 3)) = "PNG" Or _
UCase(Right(xFile, 3)) = "TIF" Or _
UCase(Right(xFile, 3)) = "JPG" Or _
UCase(Right(xFile, 3)) = "GIF" Or _
UCase(Right(xFile, 3)) = "BMP" Then
With Selection
.InlineShapes.AddPicture xPath & "" & xFile, False, True
.InsertAfter vbCrLf
.MoveDown wdLine
.Text = xFile & Chr(10)
.MoveDown wdLine
End With
End If
xFile = Dir()
Loop
End If
End If
End Sub