0

Is there an Outlook autocorrect object? I’m looking to speed up the process to add autocorrect items into outlooks autocorrect library.

I thought something like: AutoCorrect.Entries.Add Name:=BadWord, Value:= GoodWord might work but it. Others also suggested adding the work to a MSWord autocorrect object.

BMoore
  • 49
  • 4
  • Look at AutoCorrect2007 which can be used to bulk add entries to Word's AutoCorrect. http://jay-freedman.info/ Unformatted entries in Word's AutoCorrect are shared with Outlook. Formatted entries for Outlook need to be stored in the NormalEmail.dotm template AFAIK. – Charles Kenyon Jan 10 '23 at 18:03
  • The code in AutoCorrect2007 is open for inspection in the userform. – Charles Kenyon Jan 11 '23 at 15:17

3 Answers3

0

The Outlook object model doesn't provide anything for that. Note, Outlook uses Word as an email editor, so you can take at Word capabilities instead. For example:

Application.ActiveInspector.WordEditor.AutoCorrect.Entries.Add Name:="thier", Value:="their"

You may find the Recheck Document For Spellings Not Same as VBA Code thread helpful.

Eugene Astafiev
  • 47,483
  • 3
  • 24
  • 45
0

You can try to use AutoCorrect object in the Word Object Model.

In Outlook, Inspector.WordEditor.Application will return the Word.Application object, so you can use Application.ActiveInspector.WordEditor.AutoCorrect.Entries.Add

Dmitry Streblechenko
  • 62,942
  • 4
  • 53
  • 78
0

Here is the implemented code I used. I eventually had to run it from Excel as my administrator has disabled Outlook macros. Much of the code is from another source that I will credit when I can find the resource again.

If you can write vba in Outlook then just change this line below; Set OutlookApp = New Outlook.Application

Sub OutlookAutoCorrector()
 
Dim msg As Outlook.MailItem
Dim OutlookApp As Outlook.Application
Dim insp As Outlook.Inspector
Dim strInput As String
 
Dim oRng As Range
Dim i As Long
 
 
Set OutlookApp = New Outlook.Application
Set insp = OutlookApp.Application.ActiveInspector
 
 
If insp.CurrentItem.Class = olMail Then
    Set msg = insp.CurrentItem
 
    If insp.EditorType = olEditorHTML Then ' outlook 2003
        Set hed = msg.GetInspector.HTMLEditor
        Set rng = hed.Selection.createRange
        rng.pasteHTML "<b><font style='color: blue; background: yellow; font-size: 14pt;'>" & rng.Text & "</font></b>"
    End If
 
    If insp.EditorType = olEditorWord Then ' outlook 2013
        Set hed = msg.GetInspector.WordEditor
        Set appWord = hed.Application
   
        Set rng = appWord.Selection '.MoveRight(Unit:=wdCharacter, Count:=1, Extend:=wdMove)
        strInput = InputBox("Autocorrect Macro: replace ==>" & rng, "Autocorrect Word Replace", "Enter replacement HERE")
       
        If strInput <> vbNullString Then
            appWord.AutoCorrect.entries.Add Name:=rng, Value:=strInput
            rng.collapse direction:=wdCollapseEnd 'UNTESTED, but something like this...
        Else
            MsgBox "Auto Correct Msgbox was closed. Try again."
        End If
    End If
 
End If
 
Set appWord = Nothing
Set insp = Nothing
Set rng = Nothing
Set hed = Nothing
Set msg = Nothing
 
End Sub
BMoore
  • 49
  • 4
  • As this is no answer: You should edit your question and put the code there. Reading [ask] and [repro] will help you. – Ike Jan 13 '23 at 14:35