ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Import images into excel cell from database (https://www.excelbanter.com/excel-programming/384756-import-images-into-excel-cell-database.html)

[email protected]

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



All times are GMT +1. The time now is 10:39 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com