Spellchecker language easy change

L

Lorenzo

Hi,

I've been searching with no success a working example ...
Does anybody has a sub or an example to change the spell check by code?
I should switch from 1033 and 1040 SpellLang.
I just want to add a button on Outlook toolbar that run a sub like this

Sub SwitchSpelling()
' this code does not work!
If LanguageSettings.LanguagePreferredForEditing = 1033 Then
set LanguageSettings.LanguagePreferredForEditing (1033)
Else
set LanguageSettings.LanguagePreferredForEditing (1040)
End If

End Sub

Ty for any help,

Lorenzo
 
E

Eric Legault [MVP - Outlook]

It doesn't work because that property is read-only.

You'll have to use the Win32 API (or Google "VB Registry Class") to change
the value of this registry key:

HKEY_CURRENT_USER\Software\Microsoft\Office\11.0\Outlook\Options\Spelling\S­peller

If you try various language selections in the Options dialog and click
Apply, you'll see the relevant values get inserted into that key if you
refresh regedit.
 
L

Lorenzo

Ty Eric,
it would be great if you could provide me an example of code to change
the value the registry.
I've never used the Win32 API in a VBA module :-(

Lorenzo
 
Top