View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
[email protected] jerrykano@gmail.com is offline
external usenet poster
 
Posts: 1
Default Import images into excel cell from database

I have a 2 part question if anybody is inclined to help me out =)

1. Is it possible to import images into an excel spreadsheet from a
database such as mysql? And could you point me to any links?

2. For now, I'm using the below macro:
Sub PictureMe()
spath = "http://127.0.0.1/"
i = 13
bcontinue = True


While bcontinue
sFilename = Worksheets(1).Cells(i, 13).Value 'get filename from cell
e.g. image1.jpg
sExt = ".jpg"

If sFilename = "" Then
bcontinue = False
Else
Cells(i, 6).Select
ActiveSheet.Pictures.Insert(spath & sFilename & sExt).Select
Selection.ShapeRange.LockAspectRatio = msoFalse
Selection.ShapeRange.Height = 142
Selection.ShapeRange.Width = 155
i = i + 1
End If
Wend
End Sub

It's pulling from a local webserver fine. It's just that it will stop
if the picture name doesn't exist in the htdocs/ directory. Ideally
I'd love it to do some type of error checking. Such as highlighting
cells where the filename doesn't exist before inserting any pictures.

Any help would be most appreciated.

Thanks!

--Jerry