• Hi All

    Please note that at the Chandoo.org Forums there is Zero Tolerance to Spam

    Post Spam and you Will Be Deleted as a User

    Hui...

  • When starting a new post, to receive a quicker and more targeted answer, Please include a sample file in the initial post.

Macro to fetch & place Images from Folder onto Excel Sheet to create simple Prd Catalog ?

mave27

New Member
Attn Excellers - i want to create a quick Prod Catalog on Excel. Below is a sample layout design

http://postimg.org/image/mj0ndsyod/

I have images stored in a Desktop Folder.

Full Image Path (Sample):
C:\Users\user\Desktop\Magento catalog\product\0\8\0861_scale.jpg

1. Can i incorporate a Macro that fetches the corresponding image from the Folder, given the path, as shown in Col B & place it Col B ?

I have about of 17K rows of data.

Anyone care to share a Macro Code ?

Thanks in Advance.
 
Last edited:
Hey Bob. I searched for both "Catalog" & "Product Catalog", but did'nt see anything in the results. Maybe i'm missing something ?! Thanks for moving the post.
Yes it can be done, has been asked before, have you tried the search box top right.
 
Thanks.

I found something here.

Here is my code:

Code:
Option Explicit

Sub InsertPic()
Dim path As String, pic As String, pname As String
Dim lastrow As Long, r As Range

path = "C:\Users\user\Desktop\Magento catalog\product" 'change as req
lastrow = Range("A" & Rows.Count).End(xlUp).Row

For Each r In Range("A2:A" & lastrow)
    If Not InStr(r.Value, "/") > 1 Then GoTo N
        pic = Trim(Left(r.Value, InStr(r.Value, "/") - 1))
        pname = path & pic & ".jpg"
            With ActiveSheet.Pictures.Insert(pname)
                .Height = 20
                .Width = 30
                .Left = 350
                .Top = (r.Row - 2) * 35 + 15
            End With
    r.Offset(0, 2).Value = pic
N: Next
End Sub

I am new to VBA. I am familiar with data analysis using Excel Functions, but unfamiliar with VBA.

The code isn't doing anything ?
 
Back
Top