Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
DiscussionsAccessExcelInfoPathOutlookPowerPointPublisherWord
DirectoryUser Groups
Related Topics
Outlook ExpressInternet ExplorerWindowsMS Server ProductsMore Topics ...

MS Office Forum / Word / Programming / November 2004

Tip: Looking for answers? Try searching our database.

Moving to the end of a paragarph with vba

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Tim - 18 Nov 2004 13:28 GMT
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/
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.