Consulting

Results 1 to 4 of 4

Thread: Insert Multiple Picture into excel thru vba

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

    Insert Multiple Picture into excel thru vba

    Hi Friends

    Hope you are doing good.

    I have multiple image files (JPG/JPEG), each image renamed specifically as to which cell number the file has to be inserted (1A, 2A, 3A,4A.....etc) I need a code/ VBA file to perform the above activity. When this code file executed, the image file (1A), will be automatically placed inside the Cell of where the text or picture name written as 1A, and so on. Until all of the file in the specified folder, in the specified filename is attached to the excel.

    I had got some vba code in which i can insert only 1 photo also it is not inserting where my picture name exisits.

    Thanks

    Dawood Book1.xlsmBook1.xlsm

  2. #2
    Maybe try this.
    Change the folder references where required.
    Sub Maybe()
    Dim i As Long, j As Long, filename
        For i = 2 To Cells(Rows.Count, 1).End(xlUp).Row
            For j = 1 To Cells(1, Columns.Count).End(xlToLeft).Column
                filename = Dir("C:\Folder With Pics\" & ActiveSheet.Cells(i, j).Value & "*")
                    ActiveSheet.Shapes.AddPicture _
                        filename:="C:\Folder With Pics\" & filename, _
                        linktofile:=msoFalse, savewithdocument:=msoCTrue, _
                    Left:=Cells(i, j).Left, Top:=Cells(i, j).Top, Width:=Cells(i, j).Width, Height:=Cells(i, j).Height
                filename = Dir
            Next j
        Next i
    End Sub
    Last edited by jolivanes; 08-15-2020 at 03:52 PM. Reason: code tags

  3. #3
    VBAX Newbie
    Joined
    Feb 2020
    Posts
    5
    Location
    THANKS BRO,IT REALLY WORKS GOOD .....

  4. #4
    VBAX Newbie
    Joined
    Feb 2020
    Posts
    5
    Location
    Dear Guys,

    Thanks for the reply.I am trying to close the thread on proper.Please consider this thread as closed

Posting Permissions

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