Readin OLE Objects into DISK

  • Thread starter Thread starter Deepak
  • Start date Start date
D

Deepak

HI,
I have to read the OLE Object from Access Database and
store them as image in the Hard Disk. I am able to save
them as JPEG's or BMP's, using the method below.
But my problem is i am not able to open the file once
saved. What am i missing in this code.It is very urgent.
Any help on this regard will be appreciated

lngBytesLeft = rsData.Fields(j).ActualSize
intFreeFile = FreeFile
Open strFullPath For Binary As #intFreeFile
Do Until lngBytesLeft <= 0
lngReadBytes = lngBytesLeft
If lngReadBytes > lngChunkSize Then
lngReadBytes = lngChunkSize
End If
byBuffer = rsData.Fields(j).GetChunk(lngReadBytes)
Put #intFreeFile, , byBuffer
lngBytesLeft = lngBytesLeft - lngReadBytes
Loop
Close #intFreeFile
 
Hi Deepak,

This code writes the contents of the OLE field to disk - complete with
what we can loosely call an OLE wrapper used by Windows. You need to
extract the original document from the packaging.

The official way of doing this seems to be
1) use a BoundObjectFrame control on a form
2) write VBA code to step through the form's recordset and, for each
record
3) tell the control to activate the embedded object (in its parent
application)
4) automate the parent application to save the file.

There's antiquated code (Access 95/Word 6) at
http://support.microsoft.com/default.aspx?scid=kb;en-us;132003&Product=acc
showing the general idea.

For more elegant approaches, see http://www.lebans.com/oletodisk.htm
 
Back
Top