Joe Was
MrExcel MVP
- Joined
- Feb 19, 2002
- Messages
- 7,539
In Excel VBA this checks the Custom Dictionary for a word:
Sub myDicList()
Dim myWord$, myDic$
myDic = Application.SpellingOptions.UserDict
myWord = InputBox("Check the Dictionaries for the Word you enter below." & _
vbLf & vbLf & "Note: Your custom dictionary is currently set to:" & vbLf & _
" " & myDic, "Lookup Your Word!")
If myWord = "" Then GoTo myEnd
If Not Application.CheckSpelling(myWord, CustomDictionary:=myDic, IgnoreUppercase:=False) Then
MsgBox "Not in dictionary!"
Else
MsgBox "Is in dictionary!"
End If
myEnd:
End Sub
But, this next code only creates a dummy custom.dic and does not update the real user custom dictionary?
Sub add_Dic()
Dim myWord$
Close #1
Open Application.SpellingOptions.UserDict For Output As #1
myWord = Selection.Value
If Not IsEmpty(myWord) Then
Write #1, myWord
MsgBox myWord & ", was Added to the current custom dictionary: " _
& Application.SpellingOptions.UserDict
End If
Close #1
End Sub
Does anyone know if you can add words by code?
From help it points to WORD as a way, but could not get it there as well?
In WORD VBA this lists the Custom Dictionaries, but can't seem to add any words to it by code?
Sub myDicts()
For Each d In CustomDictionaries
If d.Name = Application.CustomDictionaries.ActiveCustomDictionary.Name Then
MsgBox "Active Dictionary: " & d.Path & Application.PathSeparator & d.Name
Else
MsgBox "InActive Dictionary: " & d.Path & Application.PathSeparator & d.Name
End If
d.Write "Relo"
Next d
End Sub
Any ideas on adding a list of words to an Office User Defined Custom Dictionary used by Spell-Check?
The key-word Scripting Dictionary is not checked by SpellCheck even though you can add to it by code?
Sub myDicList()
Dim myWord$, myDic$
myDic = Application.SpellingOptions.UserDict
myWord = InputBox("Check the Dictionaries for the Word you enter below." & _
vbLf & vbLf & "Note: Your custom dictionary is currently set to:" & vbLf & _
" " & myDic, "Lookup Your Word!")
If myWord = "" Then GoTo myEnd
If Not Application.CheckSpelling(myWord, CustomDictionary:=myDic, IgnoreUppercase:=False) Then
MsgBox "Not in dictionary!"
Else
MsgBox "Is in dictionary!"
End If
myEnd:
End Sub
But, this next code only creates a dummy custom.dic and does not update the real user custom dictionary?
Sub add_Dic()
Dim myWord$
Close #1
Open Application.SpellingOptions.UserDict For Output As #1
myWord = Selection.Value
If Not IsEmpty(myWord) Then
Write #1, myWord
MsgBox myWord & ", was Added to the current custom dictionary: " _
& Application.SpellingOptions.UserDict
End If
Close #1
End Sub
Does anyone know if you can add words by code?
From help it points to WORD as a way, but could not get it there as well?
In WORD VBA this lists the Custom Dictionaries, but can't seem to add any words to it by code?
Sub myDicts()
For Each d In CustomDictionaries
If d.Name = Application.CustomDictionaries.ActiveCustomDictionary.Name Then
MsgBox "Active Dictionary: " & d.Path & Application.PathSeparator & d.Name
Else
MsgBox "InActive Dictionary: " & d.Path & Application.PathSeparator & d.Name
End If
d.Write "Relo"
Next d
End Sub
Any ideas on adding a list of words to an Office User Defined Custom Dictionary used by Spell-Check?
The key-word Scripting Dictionary is not checked by SpellCheck even though you can add to it by code?