copying embedded word doc to automation created doc

G

Guest

I have a table with embedded word documents in one field. I am trying to
loop through the table and insert these word documents into a word document I
created with automation.
I create the new word doc like this
On Error Resume Next
Set WordMaster = GetObject(, "Word.Application")
If Err.Number <> 0 Then
Set WordMaster = CreateObject("Word.Application")
End If
WordMaster.Visible = True
WordMaster.documents.Add
WordMaster.Selection.typetext "hello world!"

- the hello world is inserted fine.

if I open a record set of the table, how would I reference the embedded
document and add it to the new word document?


Thanks for any help.
 
J

John Nurick

Mike,

There's no easy way of doing this.

The traditional approach is to use a form with an ObjectFrame control
bound to the OLE field where the documents are. You then write code that
moves the form to the record in question and uses the Verb and Action
properties of the ObjectFrame to activate the document, after which
ordinary Word automation does the job.

Another is to use Stephen Lebans's code at
http://www.lebans.com/oletodisk.htm to extract the Word document from
the OLE field to a disk file.

I haven't had to work with embedded Word objects since Stephen made his
breakthrough, but I'd certainly look had at that before going for the
ObjectFrame approach which is too clunky for my taste.

If possible, I'd avoid using embedded documents. Either leave the
documents as disk files and just store their names, locations and other
metadata in the database; or use an OLE field to store the *contents of
the document files* rather than *the documents as embedded objects*.
(Use AppendChunk() and GetChunk() to store and retrieve file data).
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top