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

Tip: Looking for answers? Try searching our database.

selections

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
MarcoPolo - 21 Jan 2006 18:01 GMT
i have a text like this
"1. .........................incoming __% ....................1980."

if i have condition "a" i need to put the percent and then delet till end of
paragraph
if i have condition "b2 i need to delte from beginning of sentence till
"incoming"

i selct the word incoming woth find method and i do selection type and so so
on...
But how can i delete from beginning of a paragraph till the location i am?
And how can i delete from location selected till end of pargraph?
Helmut Weber - 21 Jan 2006 22:38 GMT
H,

as this is a programmer's group, I assume,
that you can adapt the following:

Sub Test400()
Dim rTmp As Range
Dim bA As Boolean ' a condition
Dim bB As Boolean ' another condition
Set rTmp = Selection.Paragraphs(1).Range
' process the paragraph the start of the selection is in
bA = False ' as you like
bB = True  ' as you like
If bA Then
  With rTmp.Find
     .Text = "_{1,}"
     .MatchWildcards = True
     .Replacement.Text = "16"
     If .Execute(Replace:=wdReplaceOne) Then
        While rTmp.Characters.Last.Next.Next <> chr(13)
           rTmp.Characters.Last.Next.Next = ""
        Wend
     End If
  End With
End If
If bB Then
  With rTmp.Find
     .Text = "incoming"
     .MatchWildcards = False
     If .Execute Then
        rTmp.Start = Selection.Paragraphs(1).Range.Start
        rTmp.End = rTmp.End - 8
        rTmp.Select ' for testing
        rTmp = ""
     End If
  End With
End If
End Sub

I'm not using "delete" as this may trigger autocorrect activities.
BTW, a single condition would probably be all you need.

Signature

Greetings from Bavaria, Germany

Helmut Weber, MVP WordVBA

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

 
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.