Results 1 to 7 of 7

Thread: VBA : Insert Pictures With Multiple Select Picture & Consecutive Placing

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #2
    Fuhrer, Vierte Reich DocAElstein's Avatar
    Join Date
    Aug 2014
    Posts
    10,457
    Rep Power
    10
    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
    Attached Files Attached Files
    Last edited by DocAElstein; 01-26-2022 at 06:01 PM.
    ….If you are my competitor, I will try all I can to beat you. But if I do, I will not belittle you. I will Salute you, because without you, I am nothing.
    If you are my enemy, we will try to kick the fucking shit out of you…..
    Winston Churchill, 1939
    Save your Forum..._
    KILL A MODERATOR!!

Similar Threads

  1. Replies: 3
    Last Post: 07-09-2020, 02:17 AM
  2. Replies: 0
    Last Post: 07-08-2020, 07:43 PM
  3. Macro To Browse&Select File and import Specific Data
    By madeinnorway in forum Excel Help
    Replies: 0
    Last Post: 09-20-2019, 01:24 AM
  4. Insert Different Picture into Multiple Sheets
    By muhammad susanto in forum Excel Help
    Replies: 4
    Last Post: 08-28-2018, 12:01 PM
  5. Insert Picture in a Cell UDF
    By Admin in forum Download Center
    Replies: 10
    Last Post: 12-07-2012, 04:49 PM

Posting Permissions

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