Results 1 to 12 of 12

[ask] vba code to pull images from folder to each column on excel

Threaded View

  1. #1
    Forum Contributor
    Join Date
    10-22-2014
    Location
    Indonesia
    MS-Off Ver
    2010
    Posts
    177

    [ask] vba code to pull images from folder to each column on excel

    Hello,

    I Search on the forum and found vba code which similar to my need. I try to edit them.

    Basically, i want to insert pictures from folder to each column ( B2, C2, D2... an so on, until the last picture).

    the code below, is working, but instead to insert to each column, it just insert to each row ( B2, B3, B4 etc).

    can anyone help?
    also i want all picture have 1 inch size ( height and weight ).

    thanks.


    Sub qiyusipicture ()
        InsertAllPix Range("B2"), _
                    "D:\New folder", _
                    "*.jpg"
    End Sub
    
    Sub InsertAllPix(r As Range, ByVal sDir As String, sFilt As String)
        Dim sPic As String
        Dim iCol As Long
        
        If Right(sDir, 1) <> "\" Then sDir = sDir & "\"
        sPic = Dir(sDir & sFilt)
        
        Do While Len(sPic)
            icol = icol + 1
            With ActiveSheet.Pictures.Insert(sDir & sPic)
                .ShapeRange.LockAspectRatio = msoFalse
                .Height = r(icol, 1).Height
                .Width = r(icol, 1).Width
                .Top = r(icol, 1).Top
                .Left = r(icol, 1).Left
                .Placement = xlMoveAndSize
            End With
            sPic = Dir
        Loop
    End Sub
    Last edited by JBeaucaire; 12-11-2014 at 06:12 AM. Reason: Added missing CODE tags. Please read and follow the Forum Rules, link above in the menu bar. Thanks.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Replies: 4
    Last Post: 12-11-2013, 04:13 AM
  2. Replies: 9
    Last Post: 10-08-2013, 02:46 PM
  3. Replies: 2
    Last Post: 10-24-2012, 01:39 PM
  4. Copy images from a folder & paste them in Excel
    By karan in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 03-22-2011, 02:40 PM
  5. [SOLVED] How do I un-embed images in Excel and save them to another folder.
    By marcusgrimm in forum Excel General
    Replies: 1
    Last Post: 06-23-2005, 07:05 PM

Bookmarks

Posting Permissions

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

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1