![]() |
|
|
|
#1
|
|||
|
|||
|
Hi!
I have a macro mainly about find and replace, how could I eliminate the message box which always asks me to start the searching from the begining. I always have to click onto the no button several times. Would be nice if macro could do it instead of me. Thanks in advance Code:
Sub PDM_csillagos()
'
' PDM_csillagos Makró
'
'
Selection.WholeStory
Selection.PasteAndFormat (wdFormatPlainText)
Selection.WholeStory
Selection.Find.ClearFormatting
Selection.Find.Replacement.ClearFormatting
With Selection.Find
.Text = """"
.Replacement.Text = ""
.Forward = True
.Wrap = wdFindAsk
.Format = False
.MatchCase = False
.MatchWholeWord = False
.MatchWildcards = False
.MatchSoundsLike = False
.MatchAllWordForms = False
End With
Selection.Find.Execute Replace:=wdReplaceAll
With Selection.Find
.Text = "?"
.Replacement.Text = ""
.Forward = True
.Wrap = wdFindAsk
.Format = False
.MatchCase = False
.MatchWholeWord = False
.MatchWildcards = False
.MatchSoundsLike = False
.MatchAllWordForms = False
End With
Selection.Find.Execute Replace:=wdReplaceAll
With Selection.Find
.Text = "^p"
.Replacement.Text = "*;"
.Forward = True
.Wrap = wdFindAsk
.Format = False
.MatchCase = False
.MatchWholeWord = False
.MatchWildcards = False
.MatchSoundsLike = False
.MatchAllWordForms = False
End With
Selection.Find.Execute Replace:=wdReplaceAll
With Selection.Find
.Text = "*;*"
.Replacement.Text = "*;"
.Forward = True
.Wrap = wdFindAsk
.Format = False
.MatchCase = False
.MatchWholeWord = False
.MatchWildcards = False
.MatchSoundsLike = False
.MatchAllWordForms = False
End With
Selection.Find.Execute Replace:=wdReplaceAll
With Selection.Find
.Text = ";*;"
.Replacement.Text = ";"
.Forward = True
.Wrap = wdFindAsk
.Format = False
.MatchCase = False
.MatchWholeWord = False
.MatchWildcards = False
.MatchSoundsLike = False
.MatchAllWordForms = False
End With
Selection.Find.Execute Replace:=wdReplaceAll
Selection.WholeStory
Selection.Copy
End Sub
|
|
#2
|
|||
|
|||
|
Hi!
Change each line ".Wrap = wdFindAsk" with "Wrap = wdFindContinue" Bye! Souriane |
|
#3
|
||||
|
||||
|
Your code is very inefficient. Try:
Code:
Sub PDM_csillagos()
Application.ScreenUpdating = False
With ActiveDocument.Range
.PasteAndFormat (wdFormatPlainText)
With .Find
.ClearFormatting
.Replacement.ClearFormatting
.Format = False
.Forward = True
.MatchCase = False
.MatchWholeWord = False
.MatchWildcards = False
.MatchSoundsLike = False
.MatchAllWordForms = False
.Wrap = wdFindContinue
.Text = """"
.Replacement.Text = ""
.Execute Replace:=wdReplaceAll
.Text = "?"
.Replacement.Text = ""
.Execute Replace:=wdReplaceAll
.Text = "^p"
.Replacement.Text = "*;"
.Execute Replace:=wdReplaceAll
.Text = "*;*"
.Replacement.Text = "*;"
.Execute Replace:=wdReplaceAll
.Text = ";*;"
.Replacement.Text = ";"
.Execute Replace:=wdReplaceAll
End With
.Copy
End With
Application.ScreenUpdating = True
End Sub
__________________
Cheers, Paul Edstein [Fmr MS MVP - Word] |
|
#4
|
|||
|
|||
|
Thank you for both of you for the fast responses, works fine!
|
|
| Thread Tools | |
| Display Modes | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| In Find and Replace, can Word stop after each Replace? | wardw | Word | 1 | 06-08-2017 02:47 PM |
MS Word 2016 Find and Replace
|
BillM | Word | 2 | 03-14-2017 10:49 AM |
Multiple find and replace Word 2016
|
benpk1 | Word VBA | 5 | 03-01-2017 02:41 AM |
Need help using Find & Replace (MS Word)
|
BZee | Word | 9 | 02-16-2015 05:45 PM |
Bad view when using Find and Find & Replace - Word places found string on top line
|
paulkaye | Word | 4 | 12-06-2011 11:05 PM |