Table at end of column

A

Adam Howard

Hello,

I'm using VBA to output multiple tables to a 2 column
document and I'm running into a problem.

To move past the end of the table, so I can output the
next, I'm using this code (when the cursor is in the last
cell of last row):

Selection.MoveDown unit:=wdLine, Count:=1
Selection.InsertAfter (vbCrLf & vbCrLf)
Selection.EndOf unit:=wdLine, Extend:=wdMove

Which works great 95% of the time. The other 5% of the time
occurs when a table ends right at the bottom of the first
column. When I step through the code in these cases, the
MoveDown appears to do nothing, then the row gets moved
over to the next column, and the vbCrLf's are inserted
inside the last cell. And since that leaves the selection
insertion point inside the table...the next table starts
building right inside there.

I can't figure out how to identify whether the table is up
against the bottom page margin, so I don't know how to
prevent this from happening. The tables aren't necessarily
inserted at the end of the document, so I can't check
against that...any suggestions? Please post and email them
to me!

Thank you!

Adam Howard
IT Specialist, Systems Applications / Computing Analyst
NOCCCD School of Continuing Education
 
H

Helmut Weber

Hi Adam,
how about checking, whether the selection after
movedown is still in the table?
MsgBox Selection.Information(wdWithInTable)
If so, then it seems to be at the bottom of the column.
Can't check that right now.
Greetings from Bavaria, Germany
Helmut Weber
"red.sys" & chr$(64) & "t-online.de"
Word 97, NT4.0
 

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