How do I incorporate this into one macro.

S

Steved

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.
 
S

SteveCalkins

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
 
S

Steved

Thankyou.

SteveCalkins said:
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

Steved said:
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.
 

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


Top