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
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