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

Tip: Looking for answers? Try searching our database.

How do I incorporate this into one macro.

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Steved - 30 May 2006 08:03 GMT
Hello from Steved

Sub Win2()
Selection.HomeKey wdStory
Selection.Find.ClearFormatting
With Selection.Find
 Do While .Execute(FindText:="F [0-9]:[0-9]:[0-9]", MatchWildcards:=True,
Wrap:=wdFindContinue, Forward:=True) = True
    Selection.Range.Delete
    Loop
   End With
End Sub

How do I turn on the extend then find Font 30 and once found and highlited
move back by -2 count and then delete, and now put this in the above macro
please.

Please look at the below to give yourself an Idea as to what I am trying to
do.

   Selection.Extend
   Selection.Find.ClearFormatting
   With Selection.Find.Font
       .Size = 30
       .Bold = True
  End With
  With Selection.Find
       .Text = ""
       .Replacement.Text = ""
       .Forward = True
       .Wrap = wdFindAsk
       .Format = True
       .MatchCase = False
       .MatchWholeWord = False
       .MatchWildcards = False
       .MatchSoundsLike = False
       .MatchAllWordForms = False
   End With
   Selection.Find.Execute
   Selection.MoveLeft Unit:=wdWord, Count:=1
   Selection.Delete Unit:=wdCharacter, Count:=1

Thankyou.
SteveCalkins - 31 May 2006 09:50 GMT
If I understand what you want to do, you need to apply the extend, save the
start of the selection, find the next matter save the end of the selection
then demark the last two words and delete as follows:

Dim selstart as long, selend as long

Once selection.extend is used then use
   selstart=selection.start
then find your font and use the following lines:
   selend=selection.end
   Activedocument.Range(selstart, selend).Select
'The above selects everything between the two search occurences
'Now deselect the items you want
   Selection.MoveLeft Unit:=wdWord, Count:=1
   Selection.Delete Unit:=wdCharacter, Count:=1

The looping for multiple instances should be trivial. Just remember that
searching again can be problematic if you do not collapse the selection
before the search.

Best regards,
Steve Calkins

> Hello from Steved
>
[quoted text clipped - 39 lines]
>
> Thankyou.
Steved - 31 May 2006 10:13 GMT
Thankyou.

> If I understand what you want to do, you need to apply the extend, save the
> start of the selection, find the next matter save the end of the selection
[quoted text clipped - 62 lines]
> >
> > Thankyou.

Rate this thread:






 
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.