Hi
I can’t help you with a full solution because I have no experience inserting pictures. (Maybe someone else may help more later)
But I can show you again how we can loop to repeat something for more than one file in a folder
Example
On my desktop, I have a folder, I did give it a name
Picture Example Folder
, its full path and file name is
C:\Users\Elston\Desktop\Picture Example Folder
https://i.postimg.cc/7b8WngcR/Pictur...My-Desktop.jpg
Picture Example Folder on My Desktop.JPG
I have two possibilities
_ 1 One by one select picture. I must do this macro two times
Code:' https://excelfox.com/forum/showthread.php/2781-VBA-Insert-Pictures-With-Multiple-Select-Picture-amp-Consecutive-Placing https://bettersolutions.com/vba/files-directories/application-getopen.htm https://docs.microsoft.com/de-de/office/vba/api/excel.application.getopenfilename Sub DoItTwoTimesForTwoFiles() Dim vPicture As Variant ' let vPicture = Application.GetOpenFilename("Pictures (*.gif; *.jpg; *.jpeg; *.tif), *.gif; *.jpg; *.jpeg; *.tif", , "Select Picture to Import") ' Let vPicture = Application.GetOpenFilename(FileFilter:="Pictures (*.gif; *.jpg; *.jpeg; *.tif), *.gif; *.jpg; *.jpeg; *.tif", FilterIndex:=1, Title:="Select Picture to Import") Let vPicture = Application.GetOpenFilename(FileFilter:="Pictures gif ,*.gif," & "Pictures jpg ,*.jpg," & "Pictures jpeg ,*.jpeg," & "Pictures tif ,*.tif,", FilterIndex:=2, Title:="Select Picture to Import", MultiSelect:=False) If vPicture = False Then Exit Sub MsgBox prompt:="The picture, you did selected it, the full path and file name it is " & vPicture End Sub
_ 2 I can do this macro just once and it will select all file
Code:Sub DoItLoopy() Dim Path As String Let Path = "C:\Users\Elston\Desktop\Picture Example Folder" ' CHANGE TO SUIT Dim FileName As String Let FileName = Dir(Path & "\*", vbNormal) Do While FileName <> "" Dim FullPathAndFileName As String Let FullPathAndFileName = Path & "\" & FileName MsgBox prompt:="The picture, it was selected, the full path and file name it is " & FullPathAndFileName ' ' You can do other things here for each file ' Let FileName = Dir Loop End Sub
Alan




Reply With Quote
Bookmarks