PDA

View Full Version : changing languageid



yky
10-22-2010, 08:11 AM
I tried to change a document's languageid from 9999999 to wdSpanish using the following two methods. None worked.

====================
Selection.WholeStory
Selection.Range.LanguageID = wdSpanish
===================== or
ActiveDocument.Content.LanguageID = wdSpanish
=====================

MsgBox (ActiveDocument.Content.LanguageID) still shows 9999999.

Any help? Thanks.

Sebastian H
10-22-2010, 01:11 PM
Works for me, using Word 2003. What do you get when you run the following code in a completely new document?

Debug.Print ActiveDocument.Content.LanguageID
Selection.WholeStory
Selection.Range.LanguageID = wdSpanish
Debug.Print ActiveDocument.Content.LanguageID
Selection.Range.LanguageID = wdGerman
Debug.Print ActiveDocument.Content.LanguageID

yky
10-22-2010, 04:28 PM
Works for me, using Word 2003. What do you get when you run the following code in a completely new document?

Debug.Print ActiveDocument.Content.LanguageID
Selection.WholeStory
Selection.Range.LanguageID = wdSpanish
Debug.Print ActiveDocument.Content.LanguageID
Selection.Range.LanguageID = wdGerman
Debug.Print ActiveDocument.Content.LanguageID
In a brand new document, I got 1034 then 1031. Changing languageid to Spanish didn't work.

When applying your code to my original document, a UTF-8 document, I got 9999999. None of the languageid changing worked.

I have been working with Word 2003. Let me try Word 2010 and see what happens.

Sebastian H
10-22-2010, 04:46 PM
Oh, interesting! So it's the code inside the document. I got a similar result now when I just entered some Chinese characters ("西班牙") into the document, and voilą, the LCID didn't change anymore, it stubbornly remained at 2052 in my case. I'm wondering if that's a bug or a feature ... :(