Greg and Paul, thanks for suggesting an option, it sounds great, but I am getting an error in that (image attached).
I am sorry, I still believe having a notepad would be better as to the speed.
Can we use a single-notepad having entries as below:
"first name" change to "^tFirst Name"
"last name" change to "Last Name^p"
"home following for" change to "who I am following for"
"over the time" change to "over time"
One of my friend suggested me a macro, but I could not run it as well.
[VBA]Public myRefPath As String
Public i As Long
Public pFind, pReplace As String
Public sFileName, rFileName As String
Sub CallListForm()
'text files' location
myRefPath = Dialogs(wdDialogToolsOptionsFileLocations).setting
If Not Right$(myRefPath, 1) = "\" Then myRefPath = myRefPath & "\"
'text files' full name
sFileName = myRefPath & "lstSearch.txt"
rFileName = myRefPath & "lstReplace.txt"
'clears the two list boxes in the refForm form
With RefForm
.lbSearch.Clear
.lbReplace.Clear
End With
Dim lFile As Long
Dim sLine As String
lFile = FreeFile()
'registers all search words into search list box
Open sFileName For Input As lFile
While Not EOF(lFile)
Line Input #lFile, sLine
RefForm.lbSearch.AddItem sLine
Wend
Close lFile
'registers all replacement words into replacement list box
Open rFileName For Input As lFile
While Not EOF(lFile)
Line Input #lFile, sLine
RefForm.lbReplace.AddItem sLine
Wend
Close lFile
RefForm.Show
End Sub
Sub CheckMatch()
'text files' location
myRefPath = Dialogs(wdDialogToolsOptionsFileLocations).setting
If Not Right$(myRefPath, 1) = "\" Then myRefPath = myRefPath & "\"
'text files' full name
sFileName = myRefPath & "lstSearch.txt"
rFileName = myRefPath & "lstReplace.txt"
'clears the two list boxes in the refForm form
With RefForm
.lbSearch.Clear
.lbReplace.Clear
End With
Dim lFile As Long
Dim sLine As String
lFile = FreeFile()
'registers all search words into search list box
Open sFileName For Input As lFile
While Not EOF(lFile)
Line Input #lFile, sLine
RefForm.lbSearch.AddItem sLine
Wend
Close lFile
'registers all replacement words into replacement list box
Open rFileName For Input As lFile
While Not EOF(lFile)
Line Input #lFile, sLine
RefForm.lbReplace.AddItem sLine
Wend
Close lFile
'checks if both list boxes have the same amount of words stored
If RefForm.lbSearch.ListCount <> RefForm.lbReplace.ListCount Then MsgBox "Data doesn't match"
'replaces all the words based on the search list and highlights them
Options.DefaultHighlightColorIndex = wdYellow
For i = 0 To RefForm.lbSearch.ListCount - 1
Selection.HomeKey unit:=wdStory
pFind = RefForm.lbSearch.List(i)
pReplace = RefForm.lbReplace.List(i)
With Selection.Find
.Text = pFind
.Forward = True
.Replacement.Highlight = True
'checks if the word has a ":" to make the replacement bold
'if not, it simply replaces it normally
If Right$(pReplace, 1) = ":" Then
.Replacement.Text = "^p" & pReplace
.Replacement.Font.Bold = True
.Execute Replace:=wdReplaceOne
Else
.Replacement.Text = pReplace
.Replacement.Font.Bold = False
.Execute Replace:=wdReplaceAll
End If