How to move to the beginning of a paragraph 
Author Message
 How to move to the beginning of a paragraph

Selection.MoveUp Unit:=wdParagraph, Count:=1 is supposed to move you to the
beginning of the current pragraph (equivalent to CTRL +UP ARROW).
However this does not appear to work for a blank  paragraph.
The (not flawless) workaround is to move to the end of the paragraph first,
then the beginning as  follows:
        Selection.MoveDown Unit:=wdParagraph, Count:=1
        Selection.MoveUp Unit:=wdParagraph, Count:=1
The only know case this will fail is on the last line of the document.
Does anyone has a more full proof way to get to the beginning of the current
paragraph?

Frank Goovaerts?



Tue, 24 May 2005 00:22:11 GMT  
 How to move to the beginning of a paragraph
Hi Frank,

Quote:
> Does anyone has a more full proof way to get to the beginning of the current
> paragraph?

Well, normally I wouldn't even MOVE to the beginning of any paragraph.
Usually, I want to process a document without moving the cursor: that's
faster, and more accurate.

In the case I would (because the user should start typing there, for
instance), then I'd collapse the range, and select that point. Roughly:

Dim rng as Word.Range

Set rng = Selection.Range.Paragraphs(1).Range
rng.Collapse wdCollapseStart
rng.Select

Cindy Meister
INTER-Solutions, Switzerland
http://homepage.swissonline.ch/cindymeister
http://www.mvps.org/word
http://go.compuserve.com/MSOfficeForum

This reply is posted in the Newsgroup; please post any follow question or
reply in the newsgroup and not by e-mail :-)



Sun, 26 Jun 2005 04:24:58 GMT  
 
 [ 2 post ] 

 Relevant Pages 

1. Cursor at beginning of paragraph

2. Delete from beginning of line to paragraph mark

3. Blank space at beginning of paragraph when Text Interpretation is set to HTML Text

4. Move to the beginning of the document

5. 2002: Moving insertion point to the beginning of a specific line

6. XmlTextReader: How move search to beginning

7. Moving paragraphs based on style

8. Detecting cursor move between paragraphs

9. moving a paragraph

10. Moving cursor to specific paragraph

11. Moving back one paragraph from bookmark

12. Delete range of paragraphs based on start text of paragraphs

 

 
Powered by phpBB® Forum Software