Add word to MS Dictionary VBA

MUKESHY12390

Well-known Member
Joined
Sep 18, 2012
Messages
901
Office Version
  1. 2013
  2. 2011
  3. 2010
  4. 2007
Platform
  1. 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.

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
 

Excel Facts

Last used cell?
Press Ctrl+End to move to what Excel thinks is the last used cell.
It shows added character in this Language "楃楶慷浲獫਍歭敫獨Ⱳ਍橫慦摬歳਍歬慤楯橦牥਍慂浴湡獶畓数浲湡਍慂浴湡獶慭癲汥൳䈊瑡慭癮即灵牥慭൮搊摫橳摦൳圊瑡牥潷汲൤䴊卋਍䭍൓洊獫਍慢浴湡畂捲൥權歬桬਍慃楲扢慥䍮牵敳਍楗摮慴歬牥൳匊瑩൨䨊摵敧敭瑮਍慃睴浯湡਍楃楶慷浲獫਍歭敫獨Ⱳ਍橫慦摬歳਍歬慤楯橦牥਍慂浴湡獶畓数浲湡਍慂浴湡獶慭癲汥൳䈊瑡慭癮即灵牥慭൮搊摫橳摦൳圊瑡牥潷汲൤䴊卋਍䭍൓洊獫਍慢浴湡畂捲൥權歬桬਍慃楲扢慥䍮牵敳਍楗摮慴歬牥൳匊瑩൨䨊摵敧敭瑮਍慃睴浯湡਍楃楶慷浲獫਍湁瑵慭൮"
 
Upvote 0

Forum statistics

Threads
1,214,585
Messages
6,120,394
Members
448,957
Latest member
Hat4Life

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