
September 12th, 2003, 11:27 AM
|
|
Junior Member
|
|
Join Date: Aug 2003
Posts: 14
Time spent in forums: < 1 sec
Reputation Power: 0
|
|
|
Check if the cell has a picture
Hi, I have a macro, which inserts pictures into the cell. The problem that I have is if the picture has already been inserted, another picture is inserted as well. I am inserting pictures of jewlery, and each jewlery has one style with different stones. I check for the first available style and insert the picture, but if another same style occurs, another picture is inserted over the previous pictures into the same cell. Here is part of my code, where I check if the cell is empty, but it doesn't seem to work. :
Dim sFilename as String
Dim spath as String
Dim sFilename3 As String
spath = "P:\Pictures\JPG\"
sFilename = Worksheets(1).Cells(i, 2).Value 'the name of file
sFilename3 = Worksheets(1).Cells(i, 1).Value 'for checking if cell is
'empty
sFilename = spath + sFilename + "aq" + ".jpg"
If oFSo.fileExists(sFilename) And sFilename3 = "" Then
ActiveSheet.Pictures.Insert(sFilename).Select
'inserts picture and select it
Selection.ShapeRange.ScaleWidth 1.3, msoFalse, msoScaleFromTopLeft
Selection.ShapeRange.ScaleHeight 1.3, msoFalse, msoScaleFromTopLefI apreciate your help in advance. Thanks so much.
|