On the File tab, go to Options > Customize Ribbon.
Under Customize the Ribbon and under Main Tabs, select the Developer check box.
After you show the tab, the Developer tab stays visible, unless you clear the check box or have to reinstall a Microsoft Office program.
The Developer tab is the place to go when you want to do or use the following:
1. Write macros.
Sub ReplaceFromTableList() Dim oChanges As Document, oDoc As Document Dim oTable As Table Dim oRng As Range Dim rFindText As Range, rReplacement As Range Dim I As Long Dim sFname As String 'Change the path in the line below to reflect the name and path of the table document sFname = "C:\Users\admin\Documents\FindReplaceTable.docx" Set oDoc = ActiveDocument Set oChanges = Documents.Open(FileName:=sFname, Visible:=False) Set oTable = oChanges.Tables(1) For I = 1 To oTable.Rows.Count Set oRng = oDoc.Range Set rFindText = oTable.Cell(I, 1).Range rFindText.End = rFindText.End - 1 Set rReplacement = oTable.Cell(I, 2).Range rReplacement.End = rReplacement.End - 1 Selection.HomeKey wdStory With oRng.Find .MatchCase = True .MatchWildcards = False .MatchWholeWord = False .Text = rFindText.Text .Replacement.Text = rReplacement.Text .Forward = True .Wrap = wdFindContinue .Execute Replace:=wdReplaceAll End With Next I oChanges.Close wdDoNotSaveChanges End Sub
save this file in Word Macro-Enabled Document .docm
2. https://docs.google.com/document/d/1QFr5VWo2sEEdven3UJqpCumu6j1Q08Y6RuX1lOF5Ozg/edit?usp=sharing
copy this format and name it as FindReplaceTable in docx format.
and update find and replace value in th
e table.
3. Next step replace below path where you saved FindReplaceTable.docx
sFname = "C:\Users\admin\Documents\FindReplaceTable.docx"
4. Run Macro
Thank you
ReplyDelete