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 / March 2007

Tip: Looking for answers? Try searching our database.

From This to this Please

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Steved - 01 Mar 2007 00:01 GMT
Hello From Steved

From This please to

1 44121 Electra Dee (4) 5m brbl
13 72231 Tatlock + (6) 4g ch
5 15336 Kay's Awake + (4) 4m b

To this Please

Electra Dee=
Tatlock=
Kays Awake=

Thankyou
Steved - 01 Mar 2007 00:17 GMT
Hello from Steved

Below works only when it finds ' and + but how to I tell the macro to ignore
if not found in a paragraph Thankyou.

Sub Test()
   Selection.Find.ClearFormatting
   With Selection.Find
       .Text = "'"
       .Replacement.Text = ""
       .Forward = True
       .Wrap = wdFindContinue
       .Format = False
       .MatchCase = False
       .MatchWholeWord = False
       .MatchWildcards = False
       .MatchSoundsLike = False
       .MatchAllWordForms = False
   End With
   Selection.Find.Execute
   Selection.Delete Unit:=wdCharacter, Count:=1
   Selection.Find.ClearFormatting
   With Selection.Find
       .Text = "+"
       .Replacement.Text = ""
       .Forward = True
       .Wrap = wdFindContinue
       .Format = False
       .MatchCase = False
       .MatchWholeWord = False
       .MatchWildcards = False
       .MatchSoundsLike = False
       .MatchAllWordForms = False
   End With
   Selection.Find.Execute
   Selection.Delete Unit:=wdCharacter, Count:=1
   Selection.TypeBackspace
   Selection.HomeKey Unit:=wdLine
   Selection.Find.ClearFormatting
   With Selection.Find
       .Text = "<[A-Za-z]@>"
       .Replacement.Text = ""
       .Forward = True
       .Wrap = wdFindContinue
       .Format = False
       .MatchCase = False
       .MatchWholeWord = False
       .MatchAllWordForms = False
       .MatchSoundsLike = False
       .MatchWildcards = True
   End With
   Selection.Find.Execute
   Selection.MoveLeft Unit:=wdCharacter, Count:=1
   Selection.HomeKey Unit:=wdLine, Extend:=wdExtend
   Selection.Delete Unit:=wdCharacter, Count:=1
   Selection.Find.ClearFormatting
   With Selection.Find
       .Text = "("
       .Replacement.Text = ""
       .Forward = True
       .Wrap = wdFindContinue
       .Format = False
       .MatchCase = False
       .MatchWholeWord = False
       .MatchWildcards = False
       .MatchSoundsLike = False
       .MatchAllWordForms = False
   End With
   Selection.Find.Execute
   Selection.TypeBackspace
   Selection.TypeBackspace
   Selection.TypeText Text:="="
   Selection.Extend
   Selection.Find.ClearFormatting
   With Selection.Find
       .Text = "(by"
       .Replacement.Text = ""
       .Forward = True
       .Wrap = wdFindContinue
       .Format = False
       .MatchCase = False
       .MatchWholeWord = False
       .MatchWildcards = False
       .MatchSoundsLike = False
       .MatchAllWordForms = False
   End With
   Selection.Find.Execute
   Selection.MoveLeft Unit:=wdCharacter, Count:=2, Extend:=wdExtend
   Selection.Delete Unit:=wdCharacter, Count:=1
   Selection.TypeText Text:=" "
   Selection.Find.ClearFormatting
   With Selection.Find
       .Text = ")"
       .Replacement.Text = ""
       .Forward = True
       .Wrap = wdFindContinue
       .Format = False
       .MatchCase = False
       .MatchWholeWord = False
       .MatchWildcards = False
       .MatchSoundsLike = False
       .MatchAllWordForms = False
   End With
   Selection.Find.Execute
   Selection.TypeText Text:=", "
   Selection.Extend
   Selection.Find.ClearFormatting
   With Selection.Find
       .Text = "PRZ"
       .Replacement.Text = ""
       .Forward = True
       .Wrap = wdFindContinue
       .Format = False
       .MatchCase = False
       .MatchWholeWord = False
       .MatchWildcards = False
       .MatchSoundsLike = False
       .MatchAllWordForms = False
   End With
   Selection.Find.Execute
   Selection.Delete Unit:=wdCharacter, Count:=1
   Selection.EndKey Unit:=wdLine
   Selection.TypeText Text:=", "
   Selection.Find.ClearFormatting
   With Selection.Find
       .Text = "L"
       .Replacement.Text = ""
       .Forward = True
       .Wrap = wdFindContinue
       .Format = False
       .MatchCase = True
       .MatchWholeWord = False
       .MatchWildcards = False
       .MatchSoundsLike = False
       .MatchAllWordForms = False
   End With
   Selection.Find.Execute
   Selection.MoveUp Unit:=wdLine, Count:=4
   Selection.EndKey Unit:=wdLine
   Selection.Extend
   Selection.Find.ClearFormatting
   With Selection.Find
       .Text = "L"
       .Replacement.Text = ""
       .Forward = True
       .Wrap = wdFindContinue
       .Format = False
       .MatchCase = True
       .MatchWholeWord = False
       .MatchWildcards = False
       .MatchSoundsLike = False
       .MatchAllWordForms = False
   End With
   Selection.Find.Execute
   Selection.MoveLeft Unit:=wdCharacter, Count:=1, Extend:=wdExtend
   Selection.Delete Unit:=wdCharacter, Count:=1
   Selection.Delete Unit:=wdCharacter, Count:=1
   Selection.EndKey Unit:=wdLine
   Selection.TypeText Text:=", "
   Selection.Delete Unit:=wdCharacter, Count:=1
   Selection.HomeKey Unit:=wdLine
   Selection.MoveDown Unit:=wdLine, Count:=1
   Selection.Extend
   Selection.Find.ClearFormatting
   Selection.Find.Font.Size = 30
   With Selection.Find
       .Text = ""
       .Replacement.Text = ""
       .Forward = True
       .Wrap = wdFindContinue
       .Format = True
       .MatchCase = False
       .MatchWholeWord = False
       .MatchWildcards = False
       .MatchSoundsLike = False
       .MatchAllWordForms = False
   End With
   Selection.Find.Execute
   Selection.MoveLeft Unit:=wdWord, Count:=1, Extend:=wdExtend
   Selection.Delete Unit:=wdCharacter, Count:=1
End Sub

> Hello From Steved
>
[quoted text clipped - 11 lines]
>
> Thankyou
Graham Mayor - 01 Mar 2007 08:33 GMT
Difficult to achieve in one pass - but

   Selection.Find.ClearFormatting
   Selection.Find.Replacement.ClearFormatting
   With Selection.Find
       .Text = "[0-9]{1,} [0-9]{5} ([A-Za-z' ]{3,})*^13"
       .Replacement.Text = "\1=^p"
       .Forward = True
       .Wrap = wdFindContinue
       .Format = False
       .MatchCase = False
       .MatchWholeWord = False
       .MatchAllWordForms = False
       .MatchSoundsLike = False
       .MatchWildcards = True
   End With
   Selection.Find.Execute replace:=wdReplaceAll
   Selection.Find.ClearFormatting
   Selection.Find.Replacement.ClearFormatting
   With Selection.Find
       .Text = " ="
       .Replacement.Text = "="
   End With
   Selection.Find.Execute replace:=wdReplaceAll

will work

Signature

<>>< ><<> ><<> <>>< ><<> <>>< <>><<>
Graham Mayor -  Word MVP

My web site www.gmayor.com
Word MVP web site http://word.mvps.org
<>>< ><<> ><<> <>>< ><<> <>>< <>><<>

> Hello From Steved
>
[quoted text clipped - 11 lines]
>
> Thankyou
Steved - 01 Mar 2007 18:14 GMT
Thanyou very much indeed Graham

> Difficult to achieve in one pass - but
>
[quoted text clipped - 38 lines]
> >
> > Thankyou
 
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.