Cannot access individual rows (or columns) in the collection

P

Peter

I get the above message (which continues... because the table contains
vertically merged cells) when trying to traverse a table with VB (Word 2000).
Is there any way around this? I really have a need to look at values in the
cells individually.

Thanks!
 
J

Jay Freedman

Peter said:
I get the above message (which continues... because the table contains
vertically merged cells) when trying to traverse a table with VB
(Word 2000). Is there any way around this? I really have a need to
look at values in the cells individually.

Thanks!

The only practical way to deal with a table containing merged cells is to
step through the cells with the .Next method:

Dim oCel As Cell
Set oCel = ActiveDocument.Tables(1).Cell(1, 1) ' or whatever table

Do While Not (oCel Is Nothing)
' do something to the cell
MsgBox oCel.Range.Text

Set oCel = oCel.Next
Loop

I'll leave it to you to translate this to your code.

--
Regards,
Jay Freedman
Microsoft Word MVP
Email cannot be acknowledged; please post all follow-ups to the newsgroup so
all may 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