MUKESHY12390
Well-known Member
- Joined
- Sep 18, 2012
- Messages
- 901
- Office Version
- 2013
- 2011
- 2010
- 2007
- Platform
- Windows
Hi,
I found this code in this forum , when I run it shows new word has been added to Dictionary. But when I open dictionary
Path : - C:\Users\mukesh\AppData\Roaming\Microsoft\UProof
Name : "CUSTOM.DIC"
Can't see any new word. that would be helpful if someone able to point me at right direction.
I found this code in this forum , when I run it shows new word has been added to Dictionary. But when I open dictionary
Path : - C:\Users\mukesh\AppData\Roaming\Microsoft\UProof
Name : "CUSTOM.DIC"
Can't see any new word. that would be helpful if someone able to point me at right direction.
Code:
Sub addToDict()
'Standard module code, like: Module1.
'Add a list of words in Column "A" to the Custom Dictionary!
Dim o_WordApp As Object
Dim o_ActCustDict As Object
Dim r_MyCell As Range, r_MyRng As Range
Dim s_MyWord$, s_ActCustDictNm$, s_MyMsg$
Dim l_LastRow&, l_StartRow&, n&
'********************************************************************
'The Row that the"Add to Dictionary" Word List Starts in!
l_StartRow = 3
'********************************************************************
l_LastRow = ActiveSheet.Range("A65536").End(xlUp).Row
Set r_MyRng = ActiveSheet.Range(Cells(l_StartRow, 1), Cells(l_LastRow, 1))
Set o_WordApp = CreateObject("Word.Application")
Set o_ActCustDict = o_WordApp.Application.CustomDictionaries.ActiveCustomDictionary
s_ActCustDictNm = o_ActCustDict.Name
s_MyMsg = "Current custom dictionary: " & s_ActCustDictNm & vbLf & "Added: "
Open o_ActCustDict.Path & "\" & o_ActCustDict.Name For Append As #1
For Each r_MyCell In r_MyRng
s_MyWord = r_MyCell.Value
If Not IsEmpty(s_MyWord) Then
If Not Application.CheckSpelling(s_MyWord, CustomDictionary:=s_ActCustDictNm, IgnoreUppercase:=False) Then
n = n + 1
Print #1, s_MyWord
s_MyMsg = s_MyMsg & s_MyWord & ", "
End If
End If
Next r_MyCell
Close #1
o_WordApp.Quit
If n > 0 Then
MsgBox s_MyMsg
Else
MsgBox s_MyMsg & " None needed to be Added!"
End If
End Sub