#1
|
|||
|
|||
Macro for batch word find and replacing ..
I need a macro for batch word find and replacing (.docx & .rtf) Am having more than 40 documents in a folder and need to find and replace the multiple strings manually can anyone help me in this regards am very thankful to them.. Macro should ask for the source folder and loop the macro to all the document’s and save in the same document. Message pop as “replaced successfully and colored in red color”. Am having macro that will replacing multiple strings on individual files but I want to do this as batch. Please find the below. MACRO FOR BATCH WORD FIND AND REPLACING Code:
Sub CHINESE_REPL() ' ' CHINESE Macro ' ' Dim row As Integer Dim aa(1 To 100) As String Dim bb(1 To 100) As String row = 1 aa(1) = "project" bb(1) = "Items" aa(2) = "This reporting period" bb(2) = "\\\Current reporting period" aa(3) = "last year" bb(3) = "Previous period" aa(4) = "Increase or decrease (%)" bb(4) = "Increase or decrease (%)" aa(5) = "Total operating income" bb(5) = "Total operating income" aa(6) = "operating profit" bb(6) = "Operating profit" aa(7) = "The total profit" bb(7) = "Total profit" While row <= 42 Selection.find.ClearFormatting Selection.find.Replacement.ClearFormatting Selection.find.Replacement.Font.Bold = True Selection.find.Replacement.Font.Color = wdColorYellow With Selection.find .Text = aa(row) .Replacement.Text = bb(row) .Forward = True .Wrap = wdFindContinue .Format = True .MatchCase = False .MatchWholeWord = False .MatchWildcards = False .MatchSoundsLike = False .MatchAllWordForms = False End With Selection.find.Execute Replace:=wdReplaceAll row = row + 1 Wend End Sub |
#2
|
||||
|
||||
This has been addressed multiple times here. Do a search (e.g. for BulkFindReplace & UpdateDocuments).
__________________
Cheers, Paul Edstein [Fmr MS MVP - Word] |
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Macro for batch process | dita | Word VBA | 7 | 10-27-2019 09:15 PM |
Batch applying a macro to remove Header and Footer using Batch Auto Addin | Edszx | Word VBA | 2 | 05-27-2019 11:16 PM |
If statement for find and replacing certain text | dwirony | Word VBA | 6 | 10-24-2016 04:03 PM |
Trying to create a macro to batch edit hyperlinks | martinlest | Excel Programming | 5 | 01-09-2015 09:34 AM |
Macro for replacing, copying and undoing. | vthomeschoolmom | Word VBA | 1 | 12-05-2012 07:41 AM |