Import images into excel cell from database

J

jerrykano

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top