Automation via MSAccess - first table on a page

Z

Zippy

I have a single Word template containing some tables. I want to open up
multiple copies of the template in one word document and fill the
tables.
I am working with Word via Ms Access 97.

I opened the template, added text to the first table on the page
using ObjWord.ActiveDocument.Tables(1)

I then inserted a page break and a second copy of the template.

I now want to fill the first table of the new page, but I'm not sure how
to locate 'table(1) on page (n)'. I could calculate the table index
since I know how many tables are on previous pages, but I would hope
there would be something neater.

I think that I should be able to do with using Range or Selection, but
I'm not sure how to do it.

Any advice?
Thanks.
 
D

Doug Robbins - Word MVP

This sounds like something for which you could be using mail merge with your
Access table as the data source.

--
Hope this helps.

Please reply to the newsgroup unless you wish to avail yourself of my
services on a paid consulting basis.

Doug Robbins - Word MVP, originally posted via msnews.microsoft.com
 
Z

Zippy

I don't think it would be suitable for a mail merge, since each page is
not a 'single record in a table':

I have a list of products and their ingredients. I need to write each
product and its ingredient to a table in Word, one product per page.
 
D

Doug Robbins - Word MVP

That makes it sound like you should be using a Report in Access rather than
using Word.

However you may also be able to do it by using the method detailed in fellow
MVP Macropod's "Word 97-2007 Catalogue/Directory Mailmerge
Tutorial" at:

http://www.wopr.com/index.php?showtopic=731107

or

http://www.gmayor.com/Zips/Catalogue Mailmerge.zip

Do read the tutorial before trying to use the mailmerge document included
with it as you must get the mail merge main document set up exactly as
required.


--
Hope this helps.

Please reply to the newsgroup unless you wish to avail yourself of my
services on a paid consulting basis.

Doug Robbins - Word MVP, originally posted via msnews.microsoft.com
 
Z

Zippy

Doug Robbins - Word said:
That makes it sound like you should be using a Report in Access rather
than using Word.

I have indeed implemented this oh so easily with a report. However, the
client needs the additional option of being able to open it in Word.

Thanks for your mail merge links. I will work through them.
 
P

Peter Jamieson

Another way to insert table data in Word is via InsertDatabase (in VBA)
or via DATABASE fields. However, the formatting options are limited so
you would have to postprocess these insertions: if you are putting
tables in your template because you want to be able to define the
formatting there rather than in code, I'd stick with what you've got.

Peter Jamieson

http://tips.pjmsn.me.uk
 

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