MS Word 2007 Custom Dictionary RRS feed

  • Question

  • Hi.

    I need to add a custom dictionary to MS-Word. I'm using the following code:

    string FullTargetPath = word.CustomDictionaries.ActiveCustomDictionary.Path + "\\common.dic";
    System.IO.File.Copy(System.IO.Path.Combine(SourceDir, "common.dic"), FullTargetPath, true);
    Word.Dictionary dic = word.Application.CustomDictionaries.Add("common.dic");
    word.Application.CustomDictionaries.ActiveCustomDictionary = dic;
    The above code works fine, except that the dictionary is not active on the first run. If I close MS-Word (without doing anything) and start it again, the dictionary is active and working. Can anyone suggest what I'm missing here?

    • Moved by Harry Zhu Monday, December 14, 2009 2:44 AM (From:Visual C# General)
    Monday, December 7, 2009 11:35 AM

All replies