reading ole objects in VBA

G

Guest

I am currently looking at converting an existing MS-Access 95 system to
MS-Access 2003. Part of the system uses ole objects to allow the users to
create documents (all different so mail merge cant be used) to print out in
one big report collated by the intended recipients. The original programmer
got round the problem with bound object frames not being resizeable by having
one field per page and having set pages. I am considering getting rid of the
MS-Access report and using Word OLE automation to create a word document.
However the only way I can see of getting the data out of the database is by
using bound object frames, opening the document in word (by using the
acOLEActivate action on the frame), selecting the document and pasting it
into the new word document - I've got this to work but it looks naff as you
can see the word documents being opened.

I guess my question is - is there any way of inserting the contents of an
Ole object field into a word document without the use of a bound object frame
or opening word?

Thanks in advance for all replies.
Martin
 
J

John Nurick

I am currently looking at converting an existing MS-Access 95 system to
MS-Access 2003. Part of the system uses ole objects to allow the users to
create documents (all different so mail merge cant be used) to print out in
one big report collated by the intended recipients. The original programmer
got round the problem with bound object frames not being resizeable by having
one field per page and having set pages. I am considering getting rid of the
MS-Access report and using Word OLE automation to create a word document.
However the only way I can see of getting the data out of the database is by
using bound object frames, opening the document in word (by using the
acOLEActivate action on the frame), selecting the document and pasting it
into the new word document - I've got this to work but it looks naff as you
can see the word documents being opened.

I guess my question is - is there any way of inserting the contents of an
Ole object field into a word document without the use of a bound object frame
or opening word?

Hi Martin,

That is the only practical way I know of. But surely the thing to do
would be to export all these embedded documents to disk files and
convert them to Word 97-2003 format once and for all. Then you could
create a Word template to hold the report, and (as you envisage)
automate Word to build it. Remember that you can

-convert the little documents into autotext entries in the template (or
a Word add-in) that you can insert as and where needed from your
automation code

-get the information in the little documents into an Access table which
your code could read and act on (e.g. assembling boilerplate text into
the Word document.
 
S

Stephen Lebans

Use Automation to accomplish your goals. No manual intervention is
required and you can set the Visible property of the Word App object to
No to keep everything hidden behind the scenes.
THere has been sample code posted many times to accomplish what you need
to do. Search GoogleGroups for:
Word Automation Save file
Groups *access*

--

HTH
Stephen Lebans
http://www.lebans.com
Access Code, Tips and Tricks
Please respond only to the newsgroups so everyone can benefit.
 

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