Is it possible to automatically trigger my autocorrect options in documents created on other computers?
In Office 2010, is there a way to trigger autocorrect on a document that someone on a different computer has created? I handle the registrations for an annual convention, and those registrations use special codes for different events. I have my autocorrect
set up to expand those codes into the full name of an event. I'd like to be able to generate that text automatically in the registrations that others send me, without paging through each document.
Sub ReplaceFromTableList()
Dim oChanges As Document, oDoc As Document
Dim oTable As Table
Dim oRng As Range
Dim rFindText As Range, rReplacement As Range
Dim i As Long
Dim sFname As String
Dim sAsk As String
sFname = "D:\My Documents\Test\Changes.docx"
Set oDoc = ActiveDocument
Set oChanges = Documents.Open(Filename:=sFname, Visible:=False)
Set oTable = oChanges.Tables(1)
For i = 1 To oTable.Rows.Count
Set oRng = oDoc.Range
Set rFindText = oTable.Cell(i, 1).Range
rFindText.End = rFindText.End - 1
Set rReplacement = oTable.Cell(i, 2).Range
rReplacement.End = rReplacement.End - 1
With oRng.Find
.ClearFormatting
.Replacement.ClearFormatting
Do While .Execute(FindText:=rFindText, _
MatchWholeWord:=True, _
MatchWildcards:=False, _
Forward:=True, _
Wrap:=wdFindStop) = True
oRng.Select
sAsk = MsgBox("Replace - " & vbCr & oRng & vbCr + vbCr & _
"with - " & vbCr & rReplacement, vbYesNo, _
"Replace from Table")
If sAsk = vbYes Then
oRng.Text = rReplacement
End If
oRng.Collapse wdCollapseEnd
Loop
End With
Next i
oChanges.Close wdDoNotSaveChanges
End Sub
Graham Mayor (Microsoft Word MVP 2002-2019) For more Word tips and downloads visit my web site https://www.gmayor.com/Word_pages.htm
Was this reply helpful?
Sorry this didn't help.
Great! Thanks for your feedback.
How satisfied are you with this reply?
Thanks for your feedback, it helps us improve the site.