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 / September 2006

Tip: Looking for answers? Try searching our database.

selecting text

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Laura - 25 Sep 2006 15:51 GMT
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
Helmut Weber - 25 Sep 2006 16:45 GMT
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

Signature

Greetings from Bavaria, Germany

Helmut Weber, MVP WordVBA

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

Laura - 26 Sep 2006 07:22 GMT
danke schön Helmut!
and enjoy the octoberfest
 
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.