V
VJ
Hello everybody,
I am using VBA (embedded in IBM Domino LotusScript) to generate a Word
2K document. The template has several tables that are populated with
backend data. Each table in the template(2X5), has two rows, the
column header and an empty data row which I call the template row .
The first column of the templaterow has a bookmark.
My pseudocode looks like this:
Goto bookmark
Selection.InsertRowsbelow(1)
'move up 1 row so now focus is on the row to be written to
Selection.Moveup(1)
For every row in the resultset,
if rowType = A then
mergecells (2,3 and 4) and write the value
Else IF rowType = B then
write to cells 1,2,3,4 and 5
End IF
' move to the 5 columnar template row below
Selection.moveDown(1) ' INCONSISTENT BEHAVIOUR
'insert from here so that word inserts a 5 columnar row instead of
copying the merged row
Selection.InsertRowsBelow(1)
Selection.HomeKey
Selection.MoveUp(1)
' ready to write another row of data
Next row
The problem I find is that, the Selection.moveDown does not seem to
work the same way in a merged cell as it would from a non-merged cell.
I have tried moveUp, moveleft and moveright. they all seem to have the
same problem. It works great if I am writing data to all the cells i.e
without merging. Once I merge I can't seem to get to the row below by
doing a Selection.MoveDown(1). I am still in the same row...
Is this a bug or am I missing something?.. Would someone please share
any suggestions, code or ideas on how to work around this?..
Many Thanks,
VJ
I am using VBA (embedded in IBM Domino LotusScript) to generate a Word
2K document. The template has several tables that are populated with
backend data. Each table in the template(2X5), has two rows, the
column header and an empty data row which I call the template row .
The first column of the templaterow has a bookmark.
My pseudocode looks like this:
Goto bookmark
Selection.InsertRowsbelow(1)
'move up 1 row so now focus is on the row to be written to
Selection.Moveup(1)
For every row in the resultset,
if rowType = A then
mergecells (2,3 and 4) and write the value
Else IF rowType = B then
write to cells 1,2,3,4 and 5
End IF
' move to the 5 columnar template row below
Selection.moveDown(1) ' INCONSISTENT BEHAVIOUR
'insert from here so that word inserts a 5 columnar row instead of
copying the merged row
Selection.InsertRowsBelow(1)
Selection.HomeKey
Selection.MoveUp(1)
' ready to write another row of data
Next row
The problem I find is that, the Selection.moveDown does not seem to
work the same way in a merged cell as it would from a non-merged cell.
I have tried moveUp, moveleft and moveright. they all seem to have the
same problem. It works great if I am writing data to all the cells i.e
without merging. Once I merge I can't seem to get to the row below by
doing a Selection.MoveDown(1). I am still in the same row...
Is this a bug or am I missing something?.. Would someone please share
any suggestions, code or ideas on how to work around this?..
Many Thanks,
VJ