Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
How to use QM's regular expression to replace text in word
#2
Quote:1.VBA:(Find replacement of define content)

With Selection.Find
.ClearFormatting
.Text = "hi"
.Replacement.ClearFormatting
.Replacement.Text = "hello"
.Execute Replace:=wdReplaceAll, Forward:=True, _
Wrap:=wdFindContinue
End With
Macro Find and Replace 1
Code:
Copy      Help
;/exe 1

typelib Word {00020905-0000-0000-C000-000000000046} 8.0
Word.Application app._getactive
app.Selection.Find.ClearFormatting()
app.Selection.Find.Text = "hi"
app.Selection.Find.Replacement.ClearFormatting()
app.Selection.Find.Replacement.Text = "hello"
VARIANT vForward=1
VARIANT vWrap=Word.wdFindContinue
VARIANT vReplaceAll=Word.wdReplaceAll
app.Selection.Find.Execute(@ @ @ @ @ @ vForward vWrap @ @ vReplaceAll)
app.ActiveDocument.Save


Messages In This Thread

Forum Jump:


Users browsing this thread: 5 Guest(s)