A
Al
BACKGROUND:
I use MS Office 2000. In an MS Word document, I have a table that is 5
columns wide, and 8 rows long. There are 3 header lines, and 5 detail lines.
I load the detail lines from an MS Access Database and MS Access VBA program
which works fine.
The entire outer table gridlines are highlighted so it looks like a table
with a box around it.
When access loads the table the last line is blank (which contains the
original formatting). This line is deleted. I move the cursor up a line and
then the last line in the table is selected and the formatting added back.
Below is the program.
Set appword = GetObject(, "Word.Application")
'FORMAT LAST ROW IN TABLE & BOTTOM TABLE LINE
1. appword.Selection.Rows.Delete
2. appword.Selection.MoveUp Unit:=wdLine, Count:=1
3. appword.Selection.SelectRow
4. With Selection.Cells
5. With .Borders(wdBorderBottom)
6. .LineStyle = wdLineStyleSingle
7. .LineWidth = wdLineWidth050pt
8. End With
9. End With
My problem that line 2 of the program moves the cursor up three lines
instead of just one.
If I have MS Word open at the time I run the Access VBA code it only moves 1
line as expected.
QUESTION:
How can I control the cursor to move up only one line instead of 3 lines?
I use MS Office 2000. In an MS Word document, I have a table that is 5
columns wide, and 8 rows long. There are 3 header lines, and 5 detail lines.
I load the detail lines from an MS Access Database and MS Access VBA program
which works fine.
The entire outer table gridlines are highlighted so it looks like a table
with a box around it.
When access loads the table the last line is blank (which contains the
original formatting). This line is deleted. I move the cursor up a line and
then the last line in the table is selected and the formatting added back.
Below is the program.
Set appword = GetObject(, "Word.Application")
'FORMAT LAST ROW IN TABLE & BOTTOM TABLE LINE
1. appword.Selection.Rows.Delete
2. appword.Selection.MoveUp Unit:=wdLine, Count:=1
3. appword.Selection.SelectRow
4. With Selection.Cells
5. With .Borders(wdBorderBottom)
6. .LineStyle = wdLineStyleSingle
7. .LineWidth = wdLineWidth050pt
8. End With
9. End With
My problem that line 2 of the program moves the cursor up three lines
instead of just one.
If I have MS Word open at the time I run the Access VBA code it only moves 1
line as expected.
QUESTION:
How can I control the cursor to move up only one line instead of 3 lines?