Importing AutoCorrect Entries

G

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:

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?
 
G

Graham Mayor

Set your macro security in Word to Medium.
The macro in the link is contained in a template. Unzip the template to your
hard drive. Double click the template in Windows Explorer. This will start
Word with that template open. Allow the macros to run and follow the help on
screen.

--
<>>< ><<> ><<> <>>< ><<> <>>< <>><<>
Graham Mayor - Word MVP


<>>< ><<> ><<> <>>< ><<> <>>< <>><<>
 
G

Gary O

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top