View Single Post
  #2   Report Post  
Posted to microsoft.public.word.docmanagement
Graham Mayor Graham Mayor is offline
external usenet poster
 
Posts: 19,312
Default Proofreading macro

You cannot 'proof read' a document with a macro. You can however use a macro
to perform a series of pre-defined replacements, such as those you have
suggested.

Save the list as a two column table. If you already have the list in the
format shown, open the list in Word and convert the text to a two column
table split at the = sign. then run the following macro. You need to bear in
mind that the searches will follow the order in the table and will complete
without prompting.


Sub ReplaceFromTableList()
Dim ChangeDoc As Document, RefDoc As Document
Dim cTable As Table
Dim oFind As Range, oReplace As Range
Dim i As Long
Dim sFname As String
'Change the path to reflect where you have saved the table document.
sFname = "D:\My Documents\Word Documents\changes.doc"
Set RefDoc = ActiveDocument
Set ChangeDoc = Documents.Open(sFname)
Set cTable = ChangeDoc.Tables(1)
RefDoc.Activate
For i = 1 To cTable.Rows.Count
Set oFind = cTable.Cell(i, 1).Range
oFind.End = oFind.End - 1
Set oReplace = cTable.Cell(i, 2).Range
oReplace.End = oReplace.End - 1
With Selection
.HomeKey wdStory
With .Find
.ClearFormatting
.Replacement.ClearFormatting
.Execute findText:=oFind, _
ReplaceWith:=oReplace, _
Replace:=wdReplaceAll, _
MatchWholeWord:=True, _
MatchWildcards:=False, _
Forward:=True, _
Wrap:=wdFindContinue
End With
End With
Next i
ChangeDoc.Close wdDoNotSaveChanges
End Sub
http://www.gmayor.com/installing_macro.htm


--

Graham Mayor - Word MVP

My web site www.gmayor.com
Word MVP web site http://word.mvps.org



"Grey Old Man" wrote in message
...
I am looking for help to write a macro that will proofread a series of
large
documents for me.

A text file will be used for all suggested replacements. For example:

phone=telephone
fax=facsimile
&=and
24 x 7=24x7
7 x 24=24x7
mgmt=management

The macro will read the text file and find and replace as appropriate.
Track changes must be switched on at the start and switched off at the end
of the routine.

The reason for using a text file is for simplicity and easy maintenance
without knowledge of VBA code. Thanks in anticipation.