Referring to Tables in VBA???????????????

K

Khurram

Hi,
I have 5 tables in a document and I want to fill them all with data
from a database using VBA, the only problem I am encountering is how
do I reference each table or refer to a particular table.
Thanks in advance.
 
D

Doug Robbins - Word MVP

Hi Khurram,

The first table in the document will be

[DocumentObject].Tables(1)

The next one will be

[DocumentObject].Tables(2)

and so on.

It's best to do something like

Dim atable As Table
Set atable = ActiveDocument.Tables(1)

then use atable.Cell(rownum, colnum) to refer to a particular cell.

Please post any further questions or followup to the newsgroups for the
benefit of others who may be interested. Unsolicited questions forwarded
directly to me will only be answered on a paid consulting basis.

Hope this helps
Doug Robbins - Word MVP
 

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