selecting text

L

Laura

hi!
i would like to know if there is any way to select the text between 2 marks.
I know to do it with bookmarks but i think that it is a very bad solution(too
slow)
i´ll put an example because the marks aren't the same at the start and at
the end

if i have this text
P*1.1*Antecedentes*Hasta la fecha actual*
x*a1* este es el anexo primero**17
A*a1* este es el apendice primero
x*a2* este es el anexo primero**15
x*a3* este es el anexo primero**22
A*a1* este es el anexo primero

i want to extract the text that has an 'x' at the beginning of the line,
from the firs asteristic, till the end of the paragraph
for example:
a1*este es el anexo primero**17
 
H

Helmut Weber

Hi Laura,

like this:

Sub Macro7()
Dim rTMp As Range
Set rTMp = selection.Paragraphs(1).Range
If rTMp.Characters(1) = "x" Then
rTMp.start = rTMp.start + 1
rTMp.End = rTMp.End - 1
rTMp.Select
' which is redundant
' for retrieving the text
MsgBox rTMp
Else
Exit Sub
End If
End Sub

--
Greetings from Bavaria, Germany

Helmut Weber, MVP WordVBA

Win XP, Office 2003
"red.sys" & Chr$(64) & "t-online.de"
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads

selecting text II 4
zoonziiLLaaaa ! 0
solo invierte 6 us$ y gana miles honestamente 2
solo invierte 6 us$ y gana miles honestamente 1
PLATA FACIL 0
PLATA FACIL 0
Ayuda inmediata 0
Ayuda pronta 0

Top