I want to select a paragraph in my macro
I have this type of line
U:\totttot\toto\t
tu\laposte.xl

At present, I search the extension .xls, then I can select the line. (result : tu\laposte.xls
How can I select the entire paragraph
U:\totttot\toto\t
tu\laposte.xl

Macro use
Selection.MoveRight Unit:=wdCharacter, Count:=
Selection.HomeKey Unit:=wdLine, Extend:=wdExten

Re: How to select a paragraph via VBA by JGM

JGM
Wed Dec 03 12:20:24 CST 2003

Hi pac,

To select the current paragraph:

Selection.Paragraphs(1).Range.Select

But this will inlcude the paragraph mark, if you do not want the paragraph
mark,
add the following line right after the first one:

Selection.MoveLeft Unit:=wdCharacter, Count:=1, _
Extend:=wdExtend

But, even better still, work with the range object:

Dim myRange As Range

Set myRange = Selection.Paragraphs(1).Range
'to remove the paragrpah mark if necessary:
myRange.SetRange myRange.Start, myRange.End - 1

Now, use myRange to copy, delete, etc. As in:

myRange.Copy
myRange.Delete

Or, if you really need to select it:

myRange.Select

HTH
Cheers!
--
_______________________________________
Jean-Guy Marcil
jmarcil@sympatico.ca

"pac" <anonymous@discussions.microsoft.com> a écrit dans le message de news:
47F644F9-1567-48F3-BF5F-DA5CD0B4943E@microsoft.com...
> I want to select a paragraph in my macro.
> I have this type of line.
> U:\totttot\toto\ti
> tu\laposte.xls
>
> At present, I search the extension .xls, then I can select the line.
(result : tu\laposte.xls)
> How can I select the entire paragraph
> U:\totttot\toto\ti
> tu\laposte.xls
>
> Macro used
> Selection.MoveRight Unit:=wdCharacter, Count:=1
> Selection.HomeKey Unit:=wdLine, Extend:=wdExtend
>
>
>



Re: How to select a paragraph via VBA by Jonathan

Jonathan
Wed Dec 03 11:56:00 CST 2003

Hi Pac

Selection.Paragraphs(1).Range.Select

--
Regards
Jonathan West - Word MVP
http://www.multilinker.com
Please reply to the newsgroup


"pac" <anonymous@discussions.microsoft.com> wrote in message
news:47F644F9-1567-48F3-BF5F-DA5CD0B4943E@microsoft.com...
> I want to select a paragraph in my macro.
> I have this type of line.
> U:\totttot\toto\ti
> tu\laposte.xls
>
> At present, I search the extension .xls, then I can select the line.
(result : tu\laposte.xls)
> How can I select the entire paragraph
> U:\totttot\toto\ti
> tu\laposte.xls
>
> Macro used
> Selection.MoveRight Unit:=wdCharacter, Count:=1
> Selection.HomeKey Unit:=wdLine, Extend:=wdExtend
>
>
>