Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- $list = gci "C:\MyDocs" -Include *.docx -Force -recurse
- foreach ($foo in $list) {
- $objWord = New-Object -ComObject word.application
- $objWord.Visible = $True
- $objDoc = $objWord.Documents.Open("$foo")
- $objSelection = $objWord.Selection
- $findtext= "String to Find"
- $ReplaceText = "Replace with String"
- $ReplaceAll = 2
- $FindContinue = 1
- $MatchFuzzy = $False
- $MatchCase = $False
- $MatchPhrase = $false
- $MatchWholeWord = $True
- $MatchWildcards = $True
- $MatchSoundsLike = $False
- $MatchAllWordForms = $False
- $Forward = $True
- $Wrap = $FindContinue
- $Format = $False
- $objSelection.Find.execute(
- $FindText,
- $MatchCase,
- $MatchWholeWord,
- $MatchWildcards,
- $MatchSoundsLike,
- $MatchAllWordForms,
- $Forward,
- $Wrap,
- $Format,
- $ReplaceText,
- $ReplaceAll
- )
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement