Microsoft Office Tutorials and References
In Depth Information
Changing Custom Dictionaries On-the-Fly
View the Appendix to learn how to store this procedure
in a Standard module.
Option explicit¶
' * * * * *¶
Sub AutoExec()¶
Dim errCounter As Long¶
'Loop as long as it takes for Word to¶
'load the toolbar when starting¶
'Continue when error occurs¶
On Error Resume Next¶
Do¶
errCounter = errCounter + 1¶
Application.CommandBars("Custom dictionaries").Visible = True¶
Loop While Err.Number <> 0 And errCounter < 50¶
On Error GoTo 0¶
FillDicList¶
ThisDocument.Save¶
End Sub¶
' * * * * *¶
Sub FillDicList()¶
'Variable declaration¶
Dim theCtrl As Office.CommandBarComboBox¶
Dim dic As Dictionary, dicCounter As Long¶
Set theCtrl = CommandBars("Custom dictionaries").Controls(1)¶
With theCtrl¶
.Clear¶
For Each dic In Application.CustomDictionaries¶
dicCounter = dicCounter + 1¶
theCtrl.AddItem dic.Name & " (" &
LanguageIDText(dic.LanguageID) & ")"¶
If dic =
Application.CustomDictionaries.ActiveCustomDictionary Then _¶
.ListIndex = dicCounter¶
Next¶
End With¶
ThisDocument.Save¶
End Sub¶
' * * * * *¶
Sub ActivateDic()¶
'Variable declaration¶
Dim theCtrl As Office.CommandBarComboBox¶
Dim szDic As String¶
Set theCtrl = CommandBars.ActionControl¶
szDic = theCtrl.Text¶
szDic = Left(szDic, InStr(szDic, "(") - 2)¶
Application.CustomDictionaries.ActiveCustomDictionary =
Application.CustomDictionaries(szDic)¶
ThisDocument.Save¶
End Sub¶
Wrd
Search JabSto ::




Custom Search