How to save the OLE Object into their respective file?

S

Shelby

Hi,

I have an Access with one of the field set to OLE Object.
That field may contain "Picture", "MS Word", "MS Powerpoint" etc.

Now I would like to save all those content into their respective file. That
means I do not want to embed the file in Access anymore. I want to store
them as a file.

I was thinking of doing an exe programe to do the job. There are about 500
records.

I tried using the ADODB.Stream object to write the binary into a file but i
didn't get what I want. For word file, what I get are all chunk data. For
picture, I can't even open the file. When I try to open up the Access and do
a Copy ole object and Paste onto my desktop, I get a Scrap file which I
can't open.


Seems like the only way to see the file is through the Access Forms.
Is there no way that I can get back the actual content into their respective
file anymore?
 
D

Dirk Goldgar

Shelby said:
Hi,

I have an Access with one of the field set to OLE Object.
That field may contain "Picture", "MS Word", "MS Powerpoint" etc.

Now I would like to save all those content into their respective
file. That means I do not want to embed the file in Access anymore. I
want to store them as a file.

I was thinking of doing an exe programe to do the job. There are
about 500 records.

I tried using the ADODB.Stream object to write the binary into a file
but i didn't get what I want. For word file, what I get are all chunk
data. For picture, I can't even open the file. When I try to open up
the Access and do a Copy ole object and Paste onto my desktop, I get
a Scrap file which I can't open.


Seems like the only way to see the file is through the Access Forms.
Is there no way that I can get back the actual content into their
respective file anymore?

Stephen Lebans has code on his web site, www.lebans.com, to save OLE
fields to bitmap and JPEG files. I don't know if he has a general
solution there, but it would be a good place to start.
 
S

Shelby

Hi Stephen Lebans,


I have tried doing up a VBA but to no avail too.
The class name returns me "StaticDib" or even nothing for some.

Shelby
 
S

Shelby

Hi,

I have downloaded DownloadFiles/ExportOLEtoJpegVer16.zip (OLEToDisk) and
tried the programe but to no avail too.
Everything was fine until I click Export button. Error was : IJL Error:
[-10] - Failed to save to JPG.

Shelby
 
J

Jim Vierra

Make the object attach to a database field of type object. Use the interface
to use the associated program save the object to a file.

If it's Word, you can get the application reference from the object and call
the save method. There used to be one good example in Access XP/2002 Help.
I haven't done this for a couple of years so I'm going from memory.
 
A

Alex Ivanov

You basically need to strip ole header from the blob and save the rest of
the field into a file. This is little complicated, because ole header is not
of constant width. This MS article may help you to figure out how to do
that, at least it gives a layout of Access OLE headers.
http://support.microsoft.com/kb/q147727/
 
E

Esther McMillen

Shelby said:
Hi,

I have an Access with one of the field set to OLE Object.
That field may contain "Picture", "MS Word", "MS Powerpoint" etc.

Now I would like to save all those content into their respective file.
That means I do not want to embed the file in Access anymore. I want to
store them as a file.

I was thinking of doing an exe programe to do the job. There are about 500
records.

I tried using the ADODB.Stream object to write the binary into a file but
i didn't get what I want. For word file, what I get are all chunk data.
For picture, I can't even open the file. When I try to open up the Access
and do a Copy ole object and Paste onto my desktop, I get a Scrap file
which I can't open.


Seems like the only way to see the file is through the Access Forms.
Is there no way that I can get back the actual content into their
respective file anymore?
 
B

Bonno Hylkema

Dear Stephen,

I am trying to figure out your 20 lines solution through Automation.

If I insert in the OLE field of a table a Word document, the following line
of code shows me the name of the application:
Me.NameOfOLEFrameControl.Object.Application.Name shows "Microsoft Word". So
that is nice.

If I insert a Paint bitmap the same line of code gives an error: VB error
2774 "Automation is not supported by this object". Does it looks like you
can not use Automation in conjunction with Paint? You can't set any
reference to a Paint library either. Does it mean that I had have to use the
Clipboard or GetChunk hacks to save a bitmap file?

I am a bit stuck on this matter. Maybe you can help me. An example of a 20
lines solution for saving Paint bitmaps would be great.

Thanks in advance, Bonno Hylkema
 
E

Esther McMillen

Shelby said:
Hi,

I have an Access with one of the field set to OLE Object.
That field may contain "Picture", "MS Word", "MS Powerpoint" etc.

Now I would like to save all those content into their respective file.
That means I do not want to embed the file in Access anymore. I want to
store them as a file.

I was thinking of doing an exe programe to do the job. There are about 500
records.

I tried using the ADODB.Stream object to write the binary into a file but
i didn't get what I want. For word file, what I get are all chunk data.
For picture, I can't even open the file. When I try to open up the Access
and do a Copy ole object and Paste onto my desktop, I get a Scrap file
which I can't open.


Seems like the only way to see the file is through the Access Forms.
Is there no way that I can get back the actual content into their
respective file anymore?
 
Top