Batch replace on Word

Microsoft Word 2007
December 9, 2010 at 02:59:34
Specs: Windows 7
Hi there.
I live in Athens and very often, I need to change some letters with other one.
For example I need to replace the string … (Alt & 0133) with three dots.
On the same text file, I also need to change some capital letters with others.
For example I need to replace the Ά with 'A. The letter Έ with 'Ε.
Is there any way to create a batch list and each time I open a file, to batch replace these characters using a list?

Best regards

See More: Batch replace on Word

Report •

December 10, 2010 at 08:25:39
I could tell you how to do this in Word, but it's kind of a pain. Instead, I'm just going to make a VBScript.

Open Notepad and save the following Unicode text as "fix.vbs" (not fix.vbs.txt). This is important. In the Save dialog, make sure you include the double quotes in the File Name, and set the Encoding as Unicode.

To use the script, drag the Word document(s), and drop them on the fix.vbs icon. This should open the document in Word, and perform the conversion.

findWhat    = Array("…",   "Ά",  "Έ")
replaceWith = Array("...", "'A", "'E")

For Each arg In WScript.Arguments
  Set Doc = GetObject(arg)
  Doc.Application.Visible = True
  For i = 0 To UBound(findWhat)
    Doc.Range(0, Doc.Application.Selection.End).Find.Execute _
      findWhat(i), True, False, False, False, False, True, 1, _
      False, replaceWith(i), 2, False, False, False, False
  Next 'i
Next 'arg

How To Ask Questions The Smart Way

Report •

December 10, 2010 at 11:20:32
Thanks man!
It works perfect!
That's what EXACTLY I was looking for

Report •
Related Solutions

Ask Question