#1   Report Post  
Posted to microsoft.public.word.docmanagement
Grey Old Man Grey Old Man is offline
external usenet poster
 
Posts: 8
Default 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   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.



  #3   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.



  #4   Report Post  
Posted to microsoft.public.word.docmanagement
Doug Robbins - Word MVP Doug Robbins - Word MVP is offline
external usenet poster
 
Posts: 8,832
Default 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   Report Post  
Posted to microsoft.public.word.docmanagement
Doug Robbins - Word MVP Doug Robbins - Word MVP is offline
external usenet poster
 
Posts: 8,832
Default 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   Report Post  
Posted to microsoft.public.word.docmanagement
Pamelia Caswell via OfficeKB.com Pamelia Caswell  via OfficeKB.com is offline
external usenet poster
 
Posts: 84
Default 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   Report Post  
Posted to microsoft.public.word.docmanagement
Pamelia Caswell via OfficeKB.com Pamelia Caswell  via OfficeKB.com is offline
external usenet poster
 
Posts: 84
Default 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

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Proofreading doesn't work (for Korean) kevin Microsoft Word Help 1 April 16th 09 06:54 PM
Common Proofreading Symbols Proofreading Symbols for Word Microsoft Word Help 0 November 14th 08 06:57 PM
Is there a specific edit/proofreading button Samct New Users 4 October 27th 06 11:59 PM
proofreading swallowbird New Users 5 March 12th 06 07:24 PM
Scroll too fast for proofreading michimac Microsoft Word Help 2 April 9th 05 03:05 AM


All times are GMT +1. The time now is 11:24 PM.

Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 Microsoft Office Word Forum - WordBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Word"