I have written some code which opens MS Word from access
and inserts data from an Access query at a specific
bookmark in the word document. I then want to insert two
blank lines and insert some standard text. It then loops
to pick up another text string to insert at the bookmark.
My code works well except that if the text string is move
than one line my blank lines and the standard text are
inserted in the middle of the string. I am
using ".Selection.EndKey Unit:=wdLine" to move to the end
of the line. Can I change anything to move to the end of
the paragraph. My difficulty is compounded as I do not
know how long each text string will be.
Helmut Weber - 18 Nov 2004 14:01 GMT
Hi Tim,
I thought there was a still simpler way,
but can't think of it.
---
With Selection
.start = .Paragraphs(1).Range.End - 1
End With
---
Greetings from Bavaria, Germany
Helmut Weber, MVP
"red.sys" & chr(64) & "t-online.de"
Word 2002, Windows 2000
Martin Seelhofer - 18 Nov 2004 15:15 GMT
Hi Tim
> I am using ".Selection.EndKey Unit:=wdLine" to move to
> the end of the line. Can I change anything to move to the
> end of the paragraph?
Simply change wdLine into wdParagraph and enjoy ;-)
Cheers,
Martin
Helmut Weber - 18 Nov 2004 15:50 GMT
Hi Martin.
that probably was what I was thinking of at first.
However, there seems to be no unit wdparagraph
for endkey. Only wdStory, wdColumn, wdLine, wdRow.
Cheers
Helmut Weber, MVP
"red.sys" & chr(64) & "t-online.de"
Word XP, Win 98
http://word.mvps.org/