• 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.

add product snaps

poojavasti

New Member
This one is related to images

I have in my D drive a folder named Photo where

all the images are cumpolsary in jpeg format.

In excel in column A from A2 onwards I have the

Product Code. This code exactly matches with the

image name in the photo folder.

I want a product image added in the L column L2 onwards

of size 0.75 x 0.75 inches.

Any formula or code that automatically inserts

the image as I enter the Product Code in column A.

My product code will be like

ABC188

XYZ336

since my images are cumpolsary in jpeg format I do

not want to add extension i.e .jpeg in the product code.


thanks
 
Good day poojavasti


This link may be of help to you.


http://www.ozgrid.com/forum/showthread.php?t=52804
 
Please try this code I dont know how to work in inch!!...

[pre]
Code:
Private Sub Worksheet_Change(ByVal Target As Range)
Dim isect As Range
Set isect = Application.Intersect(Range("A:A"), Target.Cells(1, 1))
If isect Is Nothing Then Exit Sub
GetPicture isect
End Sub
Sub GetPicture(r As Range)
Dim fName As String, s As String
fName = "D:photo" & r & ".jpeg"
s = "L" & r.Row
r.RowHeight = 75 'pixel not inch!!
On Error Resume Next
ActiveSheet.Pictures(s).Delete
Set pic = ActiveSheet.Pictures.Insert(fName)
On Error GoTo 0
If Not IsEmpty(pic) Then
With pic
.Height = 75
.Width = 75
.Left = Range(s).Left
.Top = Range(s).Top
.Name = s
End With
End If
End Sub
[/pre]
Plz forgive me if the code quality is not good or has erroe on it I'm try to learn here.
 
I tried but not working

I A2 I have put the code 1001

and in A3 it is 1003 and with the same name

I have a .jpeg image in D drive in Photo folder

But the column L is not showing the picture


thanks
 
Hi Poojavasti


I addressed a post of this nature about 18 months back. Here is the link. There is a file and the code to go with it. All you have to do is change the path to the JPEG pictures. Be assured the file does work - all you need do is get your parameters correct.


http://www.ozgrid.com/forum/showthread.php?t=163388


Take care


Smallman
 
Hello Smallman


I will check the link and try to use it first.

In case if I have any problem

will get back to you.


thanks

pooja vasti
 
@poojavasti, Please download this file and remember to enable macro before you can try to test it.

Let me know if it did not work! (I use excel 2007)

http://www.mediafire.com/download/qcinnzzghh2jz9a/picture.xlsm
 
sorry! did not work

even I have 2007.

however as I enter the code

for eg 1001 in A2 in sheet1 the row becomes

big and specially the L column becomes

as per the mentioned size. That part

is perfect. Only the pic is not attached.


thanks
 
Please check that you have D:photo1001.jpeg and not D:photo1001.jpg

This is what I can figure as error! or to be sure rename one of the file to aaa.jpeg and enter aaa in A2 for example.
 
Sorry! still not working

tried different ways.

Also when you right click on any image and go to

properties it shows as JPEG(.jpg)


thanks
 
Sorry! still not working

tried different ways.

Also when you right click on any image and go to

properties it shows as JPEG(.jpg)


thanks
 
ok, in this case I change (*.jpeg) to (*.jpg)

Please reload the file and test it again!

http://www.mediafire.com/download/qcinnzzghh2jz9a/picture.xlsm


regards
 
Hi poojavasti


I got imla's file to work. It is pretty good stuff. I think you should persist. Just make sure you have a file of the same name in your directory and then type only the name of the file ie aaa in Col A and the code should do the rest.


Take care


Smallman
 
Hi, ppojvasti!

Consider uploading a compressed file (using WinRar, WinZip, 7-Zip, or any other) which contains your sample file and your image folder. It'd be very useful for those who read this and might be able to help you. Thank you. Give a look at the green sticky posts at this forums main page for uploading guidelines.

Regards!
 
Back
Top