M
Martijn
Hi.
I'm executing a macro which inserts data from my database
into a table in Word. I start with a one-cell-table and
then every new row from the db should be a new line in the
table, therefore I am using a For...Next routine like this:
For rowcounter=0 to NumRows
[insert statements]
ActiveDocument.Tables(1).Range.Rows.Add
Selection.MoveDown Unit:=wdLine, Count:=1
Next
The problem seems to be that Word cannot keep up with the
pace of this for...next loop. Particularly when it comes
to moving down to the next row. Without warning, it
randomly skips moving to the new row, thus leaving me with
cells with more than one row's worth of information. I
can't find any logic in why the move is not performed.
Is there a way to slow down the execution of the code so
that Word does keep up with it? Changing the unit
to 'wdParagraph' did not do the trick.
Thanks for thinking along!
I'm executing a macro which inserts data from my database
into a table in Word. I start with a one-cell-table and
then every new row from the db should be a new line in the
table, therefore I am using a For...Next routine like this:
For rowcounter=0 to NumRows
[insert statements]
ActiveDocument.Tables(1).Range.Rows.Add
Selection.MoveDown Unit:=wdLine, Count:=1
Next
The problem seems to be that Word cannot keep up with the
pace of this for...next loop. Particularly when it comes
to moving down to the next row. Without warning, it
randomly skips moving to the new row, thus leaving me with
cells with more than one row's worth of information. I
can't find any logic in why the move is not performed.
Is there a way to slow down the execution of the code so
that Word does keep up with it? Changing the unit
to 'wdParagraph' did not do the trick.
Thanks for thinking along!