Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.word.docmanagement
|
|||
|
|||
Find & Replace - Editing Question
Hi
With word, is there a way or an add-on that I can use for this: When I run the spell check I want condition to change to cond. I know you can use the find & replace, but there are some words I use a lot and it would be a lot easier if the spell check just picked these words up and changed them. I can't use autocorrect to do it because most of the text I work with is copy and pasted. Can't wait to hear what you think! |
#2
Posted to microsoft.public.word.docmanagement
|
|||
|
|||
Find & Replace - Editing Question
The short answer is no. Spell check does not work like this. You can,
however do it with a macro. Create a document with two column table containing the words to replaced in the left column and their replacements in the right. Then save it as a document and close it.. With your document active, run the following macro to use that table to make the changes in your document: In the following macro, change the line sFname = "D:\My Documents\Test\changes.doc" to reflect the name and path of the document containing the table. Sub ReplaceFromTableList() Dim ChangeDoc As Document, RefDoc As Document Dim cTable As Table Dim oldPart As Range, newPart As Range Dim i As Long Dim sFname As String sFname = "D:\My Documents\Test\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 oldPart = cTable.Cell(i, 1).Range oldPart.End = oldPart.End - 1 Set newPart = cTable.Cell(i, 2).Range newPart.End = newPart.End - 1 With Selection .HomeKey wdStory With .Find .ClearFormatting .Replacement.ClearFormatting .Execute findText:=oldPart, _ ReplaceWith:=newPart, _ 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 Tricia wrote: Hi With word, is there a way or an add-on that I can use for this: When I run the spell check I want condition to change to cond. I know you can use the find & replace, but there are some words I use a lot and it would be a lot easier if the spell check just picked these words up and changed them. I can't use autocorrect to do it because most of the text I work with is copy and pasted. Can't wait to hear what you think! |
#3
Posted to microsoft.public.word.docmanagement
|
|||
|
|||
Find & Replace - Editing Question
Tricia,
You could also make use of autocorrect where the documents are not typed already, say, if you type cond it stays cond and if you type condition it becomes cond: cond = cond condition = cond Of course you can use any abbreviations you like. Janine "Tricia" wrote in message ... Hi With word, is there a way or an add-on that I can use for this: When I run the spell check I want condition to change to cond. I know you can use the find & replace, but there are some words I use a lot and it would be a lot easier if the spell check just picked these words up and changed them. I can't use autocorrect to do it because most of the text I work with is copy and pasted. Can't wait to hear what you think! |
#4
Posted to microsoft.public.word.docmanagement
|
|||
|
|||
Find & Replace - Editing Question
Oops, just ignore my previous email - I missed the "autocorrect" can't
use... "Tricia" wrote in message ... Hi With word, is there a way or an add-on that I can use for this: When I run the spell check I want condition to change to cond. I know you can use the find & replace, but there are some words I use a lot and it would be a lot easier if the spell check just picked these words up and changed them. I can't use autocorrect to do it because most of the text I work with is copy and pasted. Can't wait to hear what you think! |
#5
Posted to microsoft.public.word.docmanagement
|
|||
|
|||
Find & Replace - Editing Question
Hi Graham, Thanks for your help, I finally have time to try it. I have no experience with macros, but I have followed your advice, and this is exactly what I have (see below) and it says: this command will stop the debugger and/or compile error: Expected End Sub. I know I have screwed it up somewhere. If you have spare time could you please tell me what you think about it. Tricia Sub Macro4() ' ' Macro4 Macro ' ' Sub ReplaceFromTableList() Dim ChangeDoc As Document, RefDoc As Document Dim cTable As Table Dim oldPart As Range, newPart As Range Dim i As Long Dim sFname As String sFname = "C:\Users\Tricia\Documents\TraderMacro.doc" Set RefDoc = ActiveDocument Set ChangeDoc = Documents.Open(sFname) Set cTable = ChangeDoc.Tables(1) RefDoc.Activate For i = 1 To cTable.Rows.Count Set oldPart = cTable.Cell(i, 1).Range oldPart.End = oldPart.End - 1 Set newPart = cTable.Cell(i, 2).Range newPart.End = newPart.End - 1 With Selection .HomeKey wdStory With .Find .ClearFormatting .Replacement.ClearFormatting .Execute findText:=oldPart, _ ReplaceWith:=newPart, _ Replace:=wdReplaceAll, _ MatchWholeWord:=True, _ MatchWildcards:=False, _ Forward:=True, _ Wrap:=wdFindContinue End With End With Next i ChangeDoc.Close wdDoNotSaveChanges End Sub |
#6
Posted to microsoft.public.word.docmanagement
|
|||
|
|||
Find & Replace - Editing Question
Delete the line that says "Sub Macro4()"
-- Enjoy, Tony www.WordArticles.com "Tricia" wrote in message ... Hi Graham, Thanks for your help, I finally have time to try it. I have no experience with macros, but I have followed your advice, and this is exactly what I have (see below) and it says: this command will stop the debugger and/or compile error: Expected End Sub. I know I have screwed it up somewhere. If you have spare time could you please tell me what you think about it. Tricia Sub Macro4() ' ' Macro4 Macro ' ' Sub ReplaceFromTableList() Dim ChangeDoc As Document, RefDoc As Document Dim cTable As Table Dim oldPart As Range, newPart As Range Dim i As Long Dim sFname As String sFname = "C:\Users\Tricia\Documents\TraderMacro.doc" Set RefDoc = ActiveDocument Set ChangeDoc = Documents.Open(sFname) Set cTable = ChangeDoc.Tables(1) RefDoc.Activate For i = 1 To cTable.Rows.Count Set oldPart = cTable.Cell(i, 1).Range oldPart.End = oldPart.End - 1 Set newPart = cTable.Cell(i, 2).Range newPart.End = newPart.End - 1 With Selection .HomeKey wdStory With .Find .ClearFormatting .Replacement.ClearFormatting .Execute findText:=oldPart, _ ReplaceWith:=newPart, _ Replace:=wdReplaceAll, _ MatchWholeWord:=True, _ MatchWildcards:=False, _ Forward:=True, _ Wrap:=wdFindContinue End With End With Next i ChangeDoc.Close wdDoNotSaveChanges End Sub |
#7
Posted to microsoft.public.word.docmanagement
|
|||
|
|||
Find & Replace - Editing Question
now it doesn't like this line:
Set ChangeDoc = Documents.Open(sFname) "Tony Jollans" wrote: Delete the line that says "Sub Macro4()" -- Enjoy, Tony www.WordArticles.com "Tricia" wrote in message ... Hi Graham, Thanks for your help, I finally have time to try it. I have no experience with macros, but I have followed your advice, and this is exactly what I have (see below) and it says: this command will stop the debugger and/or compile error: Expected End Sub. I know I have screwed it up somewhere. If you have spare time could you please tell me what you think about it. Tricia Sub Macro4() ' ' Macro4 Macro ' ' Sub ReplaceFromTableList() Dim ChangeDoc As Document, RefDoc As Document Dim cTable As Table Dim oldPart As Range, newPart As Range Dim i As Long Dim sFname As String sFname = "C:\Users\Tricia\Documents\TraderMacro.doc" Set RefDoc = ActiveDocument Set ChangeDoc = Documents.Open(sFname) Set cTable = ChangeDoc.Tables(1) RefDoc.Activate For i = 1 To cTable.Rows.Count Set oldPart = cTable.Cell(i, 1).Range oldPart.End = oldPart.End - 1 Set newPart = cTable.Cell(i, 2).Range newPart.End = newPart.End - 1 With Selection .HomeKey wdStory With .Find .ClearFormatting .Replacement.ClearFormatting .Execute findText:=oldPart, _ ReplaceWith:=newPart, _ Replace:=wdReplaceAll, _ MatchWholeWord:=True, _ MatchWildcards:=False, _ Forward:=True, _ Wrap:=wdFindContinue End With End With Next i ChangeDoc.Close wdDoNotSaveChanges End Sub |
#8
Posted to microsoft.public.word.docmanagement
|
|||
|
|||
Find & Replace - Editing Question
sFname is defined in the line
sFname = "C:\Users\Tricia\Documents\TraderMacro.doc" is that path correct? -- Graham Mayor - Word MVP My web site www.gmayor.com Word MVP web site http://word.mvps.org Tricia wrote: now it doesn't like this line: Set ChangeDoc = Documents.Open(sFname) "Tony Jollans" wrote: Delete the line that says "Sub Macro4()" -- Enjoy, Tony www.WordArticles.com "Tricia" wrote in message ... Hi Graham, Thanks for your help, I finally have time to try it. I have no experience with macros, but I have followed your advice, and this is exactly what I have (see below) and it says: this command will stop the debugger and/or compile error: Expected End Sub. I know I have screwed it up somewhere. If you have spare time could you please tell me what you think about it. Tricia Sub Macro4() ' ' Macro4 Macro ' ' Sub ReplaceFromTableList() Dim ChangeDoc As Document, RefDoc As Document Dim cTable As Table Dim oldPart As Range, newPart As Range Dim i As Long Dim sFname As String sFname = "C:\Users\Tricia\Documents\TraderMacro.doc" Set RefDoc = ActiveDocument Set ChangeDoc = Documents.Open(sFname) Set cTable = ChangeDoc.Tables(1) RefDoc.Activate For i = 1 To cTable.Rows.Count Set oldPart = cTable.Cell(i, 1).Range oldPart.End = oldPart.End - 1 Set newPart = cTable.Cell(i, 2).Range newPart.End = newPart.End - 1 With Selection .HomeKey wdStory With .Find .ClearFormatting .Replacement.ClearFormatting .Execute findText:=oldPart, _ ReplaceWith:=newPart, _ Replace:=wdReplaceAll, _ MatchWholeWord:=True, _ MatchWildcards:=False, _ Forward:=True, _ Wrap:=wdFindContinue End With End With Next i ChangeDoc.Close wdDoNotSaveChanges End Sub |
#9
Posted to microsoft.public.word.docmanagement
|
|||
|
|||
Find & Replace - Editing Question
SUCCESS!! Thankyou your the best
The problem was: the document was not saved as 'doc' it was saved as 'docx' "Graham Mayor" wrote: sFname is defined in the line sFname = "C:\Users\Tricia\Documents\TraderMacro.doc" is that path correct? -- Graham Mayor - Word MVP My web site www.gmayor.com Word MVP web site http://word.mvps.org Tricia wrote: now it doesn't like this line: Set ChangeDoc = Documents.Open(sFname) "Tony Jollans" wrote: Delete the line that says "Sub Macro4()" -- Enjoy, Tony www.WordArticles.com "Tricia" wrote in message ... Hi Graham, Thanks for your help, I finally have time to try it. I have no experience with macros, but I have followed your advice, and this is exactly what I have (see below) and it says: this command will stop the debugger and/or compile error: Expected End Sub. I know I have screwed it up somewhere. If you have spare time could you please tell me what you think about it. Tricia Sub Macro4() ' ' Macro4 Macro ' ' Sub ReplaceFromTableList() Dim ChangeDoc As Document, RefDoc As Document Dim cTable As Table Dim oldPart As Range, newPart As Range Dim i As Long Dim sFname As String sFname = "C:\Users\Tricia\Documents\TraderMacro.doc" Set RefDoc = ActiveDocument Set ChangeDoc = Documents.Open(sFname) Set cTable = ChangeDoc.Tables(1) RefDoc.Activate For i = 1 To cTable.Rows.Count Set oldPart = cTable.Cell(i, 1).Range oldPart.End = oldPart.End - 1 Set newPart = cTable.Cell(i, 2).Range newPart.End = newPart.End - 1 With Selection .HomeKey wdStory With .Find .ClearFormatting .Replacement.ClearFormatting .Execute findText:=oldPart, _ ReplaceWith:=newPart, _ Replace:=wdReplaceAll, _ MatchWholeWord:=True, _ MatchWildcards:=False, _ Forward:=True, _ Wrap:=wdFindContinue End With End With Next i ChangeDoc.Close wdDoNotSaveChanges End Sub |
#10
Posted to microsoft.public.word.docmanagement
|
|||
|
|||
Find & Replace - Editing Question
You are welcome
-- Graham Mayor - Word MVP My web site www.gmayor.com Word MVP web site http://word.mvps.org Tricia wrote: SUCCESS!! Thankyou your the best The problem was: the document was not saved as 'doc' it was saved as 'docx' "Graham Mayor" wrote: sFname is defined in the line sFname = "C:\Users\Tricia\Documents\TraderMacro.doc" is that path correct? -- Graham Mayor - Word MVP My web site www.gmayor.com Word MVP web site http://word.mvps.org Tricia wrote: now it doesn't like this line: Set ChangeDoc = Documents.Open(sFname) "Tony Jollans" wrote: Delete the line that says "Sub Macro4()" -- Enjoy, Tony www.WordArticles.com "Tricia" wrote in message ... Hi Graham, Thanks for your help, I finally have time to try it. I have no experience with macros, but I have followed your advice, and this is exactly what I have (see below) and it says: this command will stop the debugger and/or compile error: Expected End Sub. I know I have screwed it up somewhere. If you have spare time could you please tell me what you think about it. Tricia Sub Macro4() ' ' Macro4 Macro ' ' Sub ReplaceFromTableList() Dim ChangeDoc As Document, RefDoc As Document Dim cTable As Table Dim oldPart As Range, newPart As Range Dim i As Long Dim sFname As String sFname = "C:\Users\Tricia\Documents\TraderMacro.doc" Set RefDoc = ActiveDocument Set ChangeDoc = Documents.Open(sFname) Set cTable = ChangeDoc.Tables(1) RefDoc.Activate For i = 1 To cTable.Rows.Count Set oldPart = cTable.Cell(i, 1).Range oldPart.End = oldPart.End - 1 Set newPart = cTable.Cell(i, 2).Range newPart.End = newPart.End - 1 With Selection .HomeKey wdStory With .Find .ClearFormatting .Replacement.ClearFormatting .Execute findText:=oldPart, _ ReplaceWith:=newPart, _ Replace:=wdReplaceAll, _ MatchWholeWord:=True, _ MatchWildcards:=False, _ Forward:=True, _ Wrap:=wdFindContinue End With End With Next i ChangeDoc.Close wdDoNotSaveChanges End Sub |
Reply |
Thread Tools | |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Find and replace question | Microsoft Word Help | |||
Find & Replace Question | New Users | |||
Find & Replace Question | Microsoft Word Help | |||
Find and Replace question | Microsoft Word Help | |||
--A Find & Replace Question-- | Microsoft Word Help |