Hello, is it possible to retrieve a jpg image, stored as an OLEObject in an Access database, and use it to populate an image control in Excel? In fact, any way to access the image in Excel would help.
I've seen code that works in Access, such as:
Set con = New ADODB.Connection
con.Open Mid(cdb.TableDefs("dbo_Clients").Connect, 6)
Set rst = New ADODB.Recordset
rst.Open "SELECT Photo FROM Clients WHERE ClientID=1", con, adOpenStatic, adLockOptimistic
Set stm = New ADODB.Stream
stm.Type = adTypeBinary
stm.Open
stm.Write rst("Photo").Value ' write bytes to stream
stm.Position = 0
Me.Image0.PictureData = stm.Read
but I don't think PictureData works in Excel and can't find an Object to load the stream into.
If I define an object (Test) as a Variant, I can see the binary data as bytes but don't know how to use that to show an image:
DIM Test as Variant
Test = rst.Fields("Img")
Any help/ideas very much appreciated. Thanks
David
I've seen code that works in Access, such as:
Set con = New ADODB.Connection
con.Open Mid(cdb.TableDefs("dbo_Clients").Connect, 6)
Set rst = New ADODB.Recordset
rst.Open "SELECT Photo FROM Clients WHERE ClientID=1", con, adOpenStatic, adLockOptimistic
Set stm = New ADODB.Stream
stm.Type = adTypeBinary
stm.Open
stm.Write rst("Photo").Value ' write bytes to stream
stm.Position = 0
Me.Image0.PictureData = stm.Read
but I don't think PictureData works in Excel and can't find an Object to load the stream into.
If I define an object (Test) as a Variant, I can see the binary data as bytes but don't know how to use that to show an image:
DIM Test as Variant
Test = rst.Fields("Img")
Any help/ideas very much appreciated. Thanks
David