Saving Autocorrect entries into different languages using VBA

Steve Parry

New Member
Joined
Jan 4, 2016
Messages
11
Hi all,
Another tricky one for you gurus out there!

The requirement is to have a number of predefined, user installable, corporate autocorrect entries available across a suite of Word documents (and preferably across all Excel and Word documents across the users systems, regardless of language settings).

Word documents are mostly set to English (Australia), as is the Windows language.

I have a macro written in Excel 2016 VBA that reads the corporate autocorrect entries from “Sheet1” and loads them into the application autocorrect ACL file. In Sheet1 Column A has the abbreviation and column B has the replacement text.

Code:
Sub UpdateAutocorrect ()
ver = "19 September 2016"
Dim sh1 As Worksheet, sh2 As Worksheet
Dim lastrow As Long
Dim shorttext As String, LongText As String
    Set sh1 = Worksheets("Sheet1")
    Set sh2 = Worksheets("Buttons")
    lastrow = sh1.Cells(Rows.Count, "A").End(xlUp).Row
    For RowNum = 1 To lastrow
        shorttext = sh1.Cells(RowNum, 1)
        LongText = sh1.Cells(RowNum, 2)
    On Error Resume Next ' because next line always gives an error 1004 even though it works
        Application.AutoCorrect.AddReplacement shorttext, LongText
    On Error GoTo 0
    Next RowNum
    MsgBox ("All new Autocorrect entries have been added to your Office Autocorrect dictionary." & vbcrlf & _
             " Version " & ver & " installed.")
End Sub

The issue is that Excel saves them into the MSO1033.acl file (WdEnglishUS) whereas Word uses MSO2057.acl (wdEnglishUK) for its autocorrect.
This in itself is bizarre because the language settings in both word and Excel are identical (see screenshot below) and wdEnglishUK is not anywhere to be seen!
[?How do I upload screenshot to the post?. Editing Language = English (Australia <default>, Display and Help languages both = English <default>]

Anyway, my thinking is to repeat the adding of the autocorrect entries in all of the various language files (US (1033), UK (2057) and AUS (3081)) to cover all bases, but I can’t find a way in Excel VBA to change the language or trick Excel into using the different ACL files.

Any assistance greatly appreciated as always!

Many thanks
…Steve</default></default>
 
Last edited:

Excel Facts

Create a chart in one keystroke
Select the data and press Alt+F1 to insert a default chart. You can change the default chart to any chart type
@Rob Henry. I can't PM you a reply as you're PM box is full.
Hi Rob.
Unfortunately we didn't fix it for Excel. Ended up with just an MSWord solution.
Cheers
...Steve
 
Last edited:
Upvote 0
Thanks Steve,
I only had the message to you in my sent box, and I guess that made my box full!
Sorry to hear you weren't able to find a solution that worked in Excel. I'm interested in a solution that works in all Office applications. I have some ideas that I will follow up on and will post here if I eventually find a solution.
Rob
 
Upvote 0

Forum statistics

Threads
1,214,784
Messages
6,121,535
Members
449,037
Latest member
tmmotairi

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top