automatically number a table in word document

V

VinceW

The code below opens the correct document but now I would like to number the
cells in the table. The document has 2 tables both with 2 columns in them.
I would like to automatically number the cells in table column 1 of table 2.
Any help is very much appreciated.

Thank you

Dim appWD As Word.Application
Set appWD = CreateObject("Word.Application")
appWD.Documents.Open ("C:\Microsoft Office
Datafiles\Word\DailyNotes\DailyNotes " & strDate & ".doc")
appWD.Visible = True
 
J

Jacob Skaria

Modify the filename to suit...

Dim appWD As Word.Application
Dim docWD As Word.Document

Set appWD = CreateObject("Word.Application")
Set docWD = appWD.Documents.Open("d:\New.doc")

appWD.Visible = True

For intRow = 1 To docWD.Tables(2).Rows.Count
docWD.Tables(2).Cell(intRow, 1).Range.Text = intRow
Next
 
V

VinceW

Thank you very much works perfectly.

How about 1 more question for you.

I would like to be able to copy the information from table 2 (column 2) of
document 1, without actually opening the document, and then paste it into
table 2 of this same document. Is that possible?

Thanks again in advance.
 

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