Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.word.docmanagement
|
|||
|
|||
Proofreading macro
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. |
#2
Posted to microsoft.public.word.docmanagement
|
|||
|
|||
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. |
#3
Posted to microsoft.public.word.docmanagement
|
|||
|
|||
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. |
#4
Posted to microsoft.public.word.docmanagement
|
|||
|
|||
Proofreading macro
If you had the words to be replaced in column 1 of a table in a Word
document, starting in row 2 and the replacement words in column 2 of the same table, and you save and close that document and open it when asked to do so. The following macro run when the document in which you want the replacements to be made is the active document should do what you want: Dim i As Long Dim rngFind As Range Dim rngReplace As Range Dim Source As Document Dim Target As Document Set Target = ActiveDocument Target.TrackRevisions = True With Dialogs(wdDialogFileOpen) .Show End With Set Source = ActiveDocument With Source.Tables(1) For i = 2 To .Rows.Count Set rngFind = .Cell(i, 1).Range rngFind.End = rngFind.End - 1 Set rngReplace = .Cell(i, 2).Range rngReplace.End = rngReplace.End - 1 With Target .TrackRevisions = True Selection.HomeKey wdStory Selection.Find.ClearFormatting With Selection.Find Do While .Execute(FindText:=rngFind.Text, Forward:=True, _ MatchWildcards:=False, Replacewith:=rngReplace.Text, _ Wrap:=wdFindContinue, MatchCase:=False) = True Loop End With End With Next i End With Source.Close wdDoNotSaveChanges Target.TrackRevisions = False -- Hope this helps. Please reply to the newsgroup unless you wish to avail yourself of my services on a paid consulting basis. Doug Robbins - Word MVP, originally posted via msnews.microsoft.com "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. |
#5
Posted to microsoft.public.word.docmanagement
|
|||
|
|||
Proofreading macro
If you had the words to be replaced in column 1 of a table in a Word
document, starting in row 2 and the replacement words in column 2 of the same table, and you save and close that document and open it when asked to do so. The following macro run when the document in which you want the replacements to be made is the active document should do what you want: Dim i As Long Dim rngFind As Range Dim rngReplace As Range Dim Source As Document Dim Target As Document Set Target = ActiveDocument Target.TrackRevisions = True With Dialogs(wdDialogFileOpen) .Show End With Set Source = ActiveDocument With Source.Tables(1) For i = 2 To .Rows.Count Set rngFind = .Cell(i, 1).Range rngFind.End = rngFind.End - 1 Set rngReplace = .Cell(i, 2).Range rngReplace.End = rngReplace.End - 1 With Target .TrackRevisions = True Selection.HomeKey wdStory Selection.Find.ClearFormatting With Selection.Find Do While .Execute(FindText:=rngFind.Text, Forward:=True, _ MatchWildcards:=False, Replacewith:=rngReplace.Text, _ Wrap:=wdFindContinue, MatchCase:=False) = True Loop End With End With Next i End With Source.Close wdDoNotSaveChanges Target.TrackRevisions = False -- Hope this helps. Please reply to the newsgroup unless you wish to avail yourself of my services on a paid consulting basis. Doug Robbins - Word MVP, originally posted via msnews.microsoft.com "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. |
#6
Posted to microsoft.public.word.docmanagement
|
|||
|
|||
Proofreading macro
I've used a macro similar to this for several years. I strongly recommend
that track changes be turned on --as Doug's macro does-- or the changes otherwise highlighted. Pam Doug Robbins - Word MVP wrote: If you had the words to be replaced in column 1 of a table in a Word document, starting in row 2 and the replacement words in column 2 of the same table, and you save and close that document and open it when asked to do so. The following macro run when the document in which you want the replacements to be made is the active document should do what you want: Dim i As Long Dim rngFind As Range Dim rngReplace As Range Dim Source As Document Dim Target As Document Set Target = ActiveDocument Target.TrackRevisions = True With Dialogs(wdDialogFileOpen) .Show End With Set Source = ActiveDocument With Source.Tables(1) For i = 2 To .Rows.Count Set rngFind = .Cell(i, 1).Range rngFind.End = rngFind.End - 1 Set rngReplace = .Cell(i, 2).Range rngReplace.End = rngReplace.End - 1 With Target .TrackRevisions = True Selection.HomeKey wdStory Selection.Find.ClearFormatting With Selection.Find Do While .Execute(FindText:=rngFind.Text, Forward:=True, _ MatchWildcards:=False, Replacewith:=rngReplace.Text, _ Wrap:=wdFindContinue, MatchCase:=False) = True Loop End With End With Next i End With Source.Close wdDoNotSaveChanges Target.TrackRevisions = False I am looking for help to write a macro that will proofread a series of large [quoted text clipped - 15 lines] The reason for using a text file is for simplicity and easy maintenance without knowledge of VBA code. Thanks in anticipation. -- Message posted via OfficeKB.com http://www.officekb.com/Uwe/Forums.a...ement/201005/1 |
#7
Posted to microsoft.public.word.docmanagement
|
|||
|
|||
Proofreading macro
I've used a macro similar to this for several years. I strongly recommend
that track changes be turned on --as Doug's macro does-- or the changes otherwise highlighted. Pam Doug Robbins - Word MVP wrote: If you had the words to be replaced in column 1 of a table in a Word document, starting in row 2 and the replacement words in column 2 of the same table, and you save and close that document and open it when asked to do so. The following macro run when the document in which you want the replacements to be made is the active document should do what you want: Dim i As Long Dim rngFind As Range Dim rngReplace As Range Dim Source As Document Dim Target As Document Set Target = ActiveDocument Target.TrackRevisions = True With Dialogs(wdDialogFileOpen) .Show End With Set Source = ActiveDocument With Source.Tables(1) For i = 2 To .Rows.Count Set rngFind = .Cell(i, 1).Range rngFind.End = rngFind.End - 1 Set rngReplace = .Cell(i, 2).Range rngReplace.End = rngReplace.End - 1 With Target .TrackRevisions = True Selection.HomeKey wdStory Selection.Find.ClearFormatting With Selection.Find Do While .Execute(FindText:=rngFind.Text, Forward:=True, _ MatchWildcards:=False, Replacewith:=rngReplace.Text, _ Wrap:=wdFindContinue, MatchCase:=False) = True Loop End With End With Next i End With Source.Close wdDoNotSaveChanges Target.TrackRevisions = False I am looking for help to write a macro that will proofread a series of large [quoted text clipped - 15 lines] The reason for using a text file is for simplicity and easy maintenance without knowledge of VBA code. Thanks in anticipation. -- Message posted via OfficeKB.com http://www.officekb.com/Uwe/Forums.a...ement/201005/1 |
Reply |
Thread Tools | |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Proofreading doesn't work (for Korean) | Microsoft Word Help | |||
Common Proofreading Symbols | Microsoft Word Help | |||
Is there a specific edit/proofreading button | New Users | |||
proofreading | New Users | |||
Scroll too fast for proofreading | Microsoft Word Help |