WD: How to Use AutoCorrect on an Existing Document |
Q153670
The AutoCorrect feature works dynamically when you type a space after a word that appears in the AutoCorrect list. This feature operates while you create the document, but Word does not automatically scan a previously-created document and make AutoCorrect changes.
This article provides a sample macro that compares each word in a Word document to words in the AutoCorrect list and then replaces the matched words with the text string specified in the AutoCorrect list.
NOTE: If you are working on a very long document, this macro may take a
long time to run. To stop the macro before it is finished, press ESC.
When you save the document, Word saves all changes you made up until you pressed ESC.
Microsoft provides programming examples for illustration only, without warranty either expressed or implied, including, but not limited to, the implied warranties of merchantability and/or fitness for a particular purpose. This article assumes that you are familiar with the programming language being demonstrated and the tools used to create and debug procedures. Microsoft support professionals can help explain the functionality of a particular procedure, but they will not modify these examples to provide added functionality or construct procedures to meet your specific needs. If you have limited programming experience, you may want to contact a Microsoft Certified Partner or the Microsoft fee-based consulting line at (800) 936-5200. For more information about Microsoft Certified Partners, please see the following page on the World Wide Web:
http://www.microsoft.com/partner/referral/For more information about the support options available from Microsoft, please see the following page on the World Wide Web:
http://support.microsoft.com/directory/overview.asp
Sub MAIN
StartOfDocument
EditFindClearFormatting
EditFind .Find = " ", .Direction = 0, .MatchCase = 0, .WholeWord =
0, .PatternMatch = 0, .SoundsLike = 0, .Format = 0, .Wrap = 0,
.FindAllWordForms = 0
While EditFindFound()
WordLeft 1, 1
If GetAutoCorrect$(Selection$()) <> "" Then
Insert GetAutoCorrect$(Selection$())
End If
CharRight 2
EditFind
Wend
End Sub
Additional query words: 6.0 7.0 macword winword ntword word95 word7 wordbasic coding coded replacement exchange updating updates
Keywords : kbmacro
Issue type :
Technology : kbWordSearch kbWordWSearch
|
Last Reviewed: December 29, 2000 © 2001 Microsoft Corporation. All rights reserved. Terms of Use. |