Counting rows in a table

J

Joanne

What is wrong with this string? I've tried it with Table
(1) and Tables(1) and it still errors out on "Count". I
just want to count the number of rows in the table.

Set rcount = ActiveDocument.Table(1).Rows.Count
 
C

Chad DeMeyer

Tables(1) is the right way to access the first table in the collection of
tables in the ActiveDocument. However, if you are assigning the value of a
count to the variable rcount, you don't need a Set statement to assign the
value, because the return from the .Count property is an Integer, not an
Object data type. That is probably the source of your error.

Regards,
Chad DeMeyer
 

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