I'm wanting to maintain global AutoCorrect details for my workplace which has
four PC's. I have found the following link which is what I want to do:
http://wordtips.vitalnews.com/Pages/T1408_Importing_AutoCorrect_Entries.html
However, when I copy the macro into Word and run the macro it does not add
the new AutoCorrect entries.
If the AutoCorrect entry exists in Word, it will ask me if I want to
overwrite it, so it seems that the second part of the macro is working.
I just can't work out how to get the first part working so that it will add
AutoCorrect details to Word.
This is the code for the Macro:
Sub AddToTheAutoCorrectList()
Dim r As Range, r1 As Range
Dim par As Paragraph, bo As Boolean
Dim pars As Paragraphs
Dim ACE As AutoCorrectEntry
Dim ACEs As AutoCorrectEntries
Dim ActD As Document
Set ActD = ActiveDocument
Set pars = ActD.Paragraphs
Set r1 = Selection.Range
Set r = Selection.Range
Set ACEs = Application.AutoCorrect.Entries
On Error Resume Next
For Each par In pars
If par.Range.End = ActD.Content.End Then Exit Sub
r1.Start = par.Range.Start
r1.End = r1.Start
r1.MoveEndUntil vbTab
r.Start = r1.End + 1
r.End = par.Range.End - 1
If Len(r1.Text) > 0 Or Len(r.Text) > 0 Then
If Len(ACEs(r1.Text).Value) > 0 Then
bo = Repl(ACEs, r, r1)
Else
bo = True
End If
If bo Then ACEs.Add r1.Text, r.Text
End If
Next
End Sub
Private Function Repl(a As AutoCorrectEntries, _
r As Range, r1 As Range) As Boolean
If a(r1.Text).Value <> r.Text Then
Repl = MsgBox("To replace " & UCase(a(r1.Text).Value) & _
" with " & UCase(r.Text) & " click OK", vbYesNo + _
vbQuestion, "REPLACE ENTRY?") = vbYes
End If
End Function
Any suggestions as to how I can get this macro to work?
Doug Robbins - Word MVP - 18 Dec 2006 04:36 GMT
See the article "How can I import and export all my AutoCorrect entries, so
they can be transferred to another machine?" at:
http://www.word.mvps.org/FAQs/Customization/ExportAutocorrect.htm

Signature
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
> I'm wanting to maintain global AutoCorrect details for my workplace which
> has
[quoted text clipped - 56 lines]
>
> Any suggestions as to how I can get this macro to work?
Gary O - 19 Dec 2006 06:37 GMT
I feel a little silly!
The autocorrect.dot works a treat.
All I need to remember is to backup each individuals autocorrect, ADD the
new autocorrect entries to the table produced by the backup and then restore
the backup.
I should have tried it first before wasting everyones valuable time posting
here, my apologies.
Gary O
> I'm wanting to maintain global AutoCorrect details for my workplace which has
> four PC's. I have found the following link which is what I want to do:
[quoted text clipped - 54 lines]
>
> Any suggestions as to how I can get this macro to work?