i have written codes in excel to show data from database(MsSQL) all of them can be done except pictures .does anyone know that excel can show the picture from the database ?
i have written codes in excel to show data from database(MsSQL) all of them can be done except pictures .does anyone know that excel can show the picture from the database ?
You dont say how you are displaying the data. So the answer can only be very general.
Where and how are you displaying the data?
How is the picture "stored" in the database?
What format is the stored data?
But principlaay you will need to place a container of some sort (eg a shape or a VBA ImageControl) depending on what you are going to do with it) and set the property of the control to the image file or to an imageControl.
If the number of images is dynamic then you will benefit by creating the containers (position and size) on the fly.
More clarity in your question may result in a more prescriptive answer.
regards,
I've used this with Oracle.
oConn is a global variable (ado connection)
*********************************************************************
Sub ReadFile()
Dim stempfile As String
stempfile = "C:\local files\temp.gif"
Dim rs As ADODB.Recordset
Set rs = oConn.Execute("SELECT t.blobcolumn FROM tablename t WHERE t.id
= 2")
'Write it to disk
Dim oStream
Set oStream = CreateObject("adodb.stream")
With oStream
.Type = adTypeBinary
.Open
.Write (rs.Fields("dcmtblob2").Value)
.SaveToFile stempfile, adSaveCreateOverWrite
.Close
End With
shtData.Range("C6").Select
shtData.OLEObjects.Add Filename:=stempfile, Link:=False,
DisplayAsIcon:=False
rs.Close
Set rs = Nothing
Set oStream = Nothing
End Sub
****************************************************
--
Tim Williams
Palo Alto, CA
"tony h" <[email protected]> wrote in
message news:[email protected]...
>
> You dont say how you are displaying the data. So the answer can only be
> very general.
>
> Where and how are you displaying the data?
> How is the picture "stored" in the database?
> What format is the stored data?
>
> But principlaay you will need to place a container of some sort (eg a
> shape or a VBA ImageControl) depending on what you are going to do with
> it) and set the property of the control to the image file or to an
> imageControl.
>
> If the number of images is dynamic then you will benefit by creating
> the containers (position and size) on the fly.
>
> More clarity in your question may result in a more prescriptive
> answer.
>
> regards,
>
>
> --
> tony h
> ------------------------------------------------------------------------
> tony h's Profile:
http://www.excelforum.com/member.php...o&userid=21074
> View this thread: http://www.excelforum.com/showthread...hreadid=510960
>
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks