Results 1 to 3 of 3
  1. #1
    Platinum Lounger
    Join Date
    Feb 2001
    Location
    Yilgarn region of Toronto, Ontario
    Posts
    5,453
    Thanks
    0
    Thanked 0 Times in 0 Posts

    DetectLanguage error 4198 (Word/xp)

    The code below is pasted from the help files. On a new document it fails with "Run time error 4198", and does the same on an existing document.
    I find nothing in MSKB that suggests a languageid problem, but many references to '4198' that suggest it is a general catch-all error message.

    If it is a general error-message, I can't think why the sample code should fail, and would appreciate hearing from anyone for whom this code works (if possible with an attached document)

    <pre>Sub test()
    Dim x
    With ActiveDocument
    If .LanguageDetected = True Then
    x = MsgBox("This document has already " _
    & "been checked. Do you want to check " _
    & "it again?", vbYesNo)
    If x = vbYes Then
    .LanguageDetected = False
    .DetectLanguage ' Run time error 4198
    End If
    Else
    .DetectLanguage ' Run time error 4198
    End If
    If .Range.LanguageID = wdEnglishUS Then
    MsgBox "This is a U.S. English document."
    Else
    MsgBox "This is not a U.S. English document."
    End If
    End With
    End Sub</pre>


  2. #2
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: DetectLanguage error 4198 (Word/xp)

    I have tried the code on various documents (Dutch, UK English and US English), and it ran without errors. It doesn't always detect the language correctly, though - LanguageID is often 9999999 meaning mixed, even if the entire document was set to a single language.

  3. #3
    Platinum Lounger
    Join Date
    Feb 2001
    Location
    Yilgarn region of Toronto, Ontario
    Posts
    5,453
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: DetectLanguage error 4198 (Word/xp)

    Thanks, Hans. It must be me then (sulks!). I'll try with a bigger hammer to see if I can get it working.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •