Results 1 to 17 of 17

Thread: Using Word dictionary for spell check

  1. #1

    Thread Starter
    Fanatic Member AccessShell's Avatar
    Join Date
    Oct 2013
    Posts
    790

    Question Using Word dictionary for spell check

    I wrote a program in VB6 many years ago on WIN XP using a Word dictionary for spell checking.
    Also wrote a similar program on Win 7 pro.

    I just found out that these two programs do not run on my Win 10 Home. I get the error msg
    "Automation Error Library not registered
    Run time error '-2147319779 (8002801d)':

    I don't know how to register. I don't know what to register.

    I don't know if that would solve the problem, But I think it would.

    Any help would be appreciated.

  2. #2
    PowerPoster
    Join Date
    Feb 2017
    Posts
    4,997

    Re: Using Word dictionary for spell check

    I guess it must be that you don't have Office installed or the proper version of Office installed.

  3. #3
    Member
    Join Date
    Jan 2021
    Posts
    55

    Re: Using Word dictionary for spell check

    I use the InkEdit Control (Work as RichText with same controls) and I can use right click to correct and underline the errors. In this way i don't need Word





    Code:
    Private Const WM_USER As Long = &H400&
    Private Const EM_SETLANGOPTIONS As Long = WM_USER + 120&
    Private Const IMF_SPELLCHECKING As Long = &H800&
    Private Const IMF_TKBPREDICTION As Long = &H1000&
    Private Const IMF_TKBAUTOCORRECTION As Long = &H2000&
    Private Const EM_SETEDITSTYLE As Long = WM_USER + 204&
    Private Const SES_USECTF As Long = &H10000
    Private Const SES_CTFALLOWEMBED As Long = &H200000
    Private Const SES_CTFALLOWSMARTTAG As Long = &H400000
    Private Const SES_CTFALLOWPROOFING As Long = &H800000
    Private Declare Function SendMessageLong _
       Lib "user32" _
       Alias "SendMessageA" (ByVal hWnd As Long, _
       ByVal wMsg As Long, _
       ByVal wParam As Long, _
       ByVal lParam As Long) As Long
    
    Private Sub Form_Load()
        With Me.InkEdit
            SendMessageLong .hWnd, EM_SETLANGOPTIONS, 0, IMF_SPELLCHECKING Or IMF_TKBPREDICTION Or IMF_TKBAUTOCORRECTION
            SendMessageLong .hWnd, EM_SETEDITSTYLE, SES_USECTF Or SES_CTFALLOWEMBED Or SES_CTFALLOWSMARTTAG Or SES_CTFALLOWPROOFING, SES_USECTF Or SES_CTFALLOWEMBED Or SES_CTFALLOWSMARTTAG Or SES_CTFALLOWPROOFING
        End With
    End Sub

  4. #4
    Frenzied Member
    Join Date
    Dec 2012
    Posts
    1,470

    Re: Using Word dictionary for spell check

    I also use an InkEdit Control, as demonstrated in this post:
    https://www.vbforums.com/showthread....VB6-Ink-Editor

    J.A. Coutts

  5. #5
    Lively Member
    Join Date
    May 2021
    Posts
    95

    Re: Using Word dictionary for spell check

    I wonder if perhaps you're code is referencing the wrong Word library (i.e., I'm using the Word 16.0 Object Library), but then I would expect an different error message/problem. What does your code look like? If all else fails (I've also used the Ink Edit code above), the Excel Application object has a CheckSpelling method...

  6. #6
    Member
    Join Date
    Jan 2021
    Posts
    55

    Re: Using Word dictionary for spell check

    Quote Originally Posted by Dan_W View Post
    I wonder if perhaps you're code is referencing the wrong Word library (i.e., I'm using the Word 16.0 Object Library), but then I would expect an different error message/problem. What does your code look like? If all else fails (I've also used the Ink Edit code above), the Excel Application object has a CheckSpelling method...
    You can have the reference for Office 15 and use Office 2021 without Office 2010

    Ink Editor use Check Spelling Windows API, if fails is something wrong with your code

  7. #7
    PowerPoster
    Join Date
    Jul 2010
    Location
    NYC
    Posts
    5,652

    Re: Using Word dictionary for spell check

    Related, a while back we were playing around with accessing the spell check API directly, here's a demo:

    https://www.vbforums.com/showthread....ly-a-few-lines

    Read the replies too, worked on adding more features.

  8. #8

    Thread Starter
    Fanatic Member AccessShell's Avatar
    Join Date
    Oct 2013
    Posts
    790

    Re: Using Word dictionary for spell check

    Sorry for not replying sooner. I never got an email that anyone responded to this thread.

    I have checked this program on my old WIN 7 Pro computer (not connected to the internet). The code is the same. The references are the same. The reference to MS Office is the same. Yes, it is an old Office.

    The program works just fine on WIN 7.

  9. #9

    Thread Starter
    Fanatic Member AccessShell's Avatar
    Join Date
    Oct 2013
    Posts
    790

    Re: Using Word dictionary for spell check

    I have been looking on-line and in several forum trying to find code which accesses the MS Word disctionary. All of the ones I tried break at the same place with the same message.

    I also checked dthe location of the reference on both the WIN 7 and WIN 10 computers. The location was the same and in that loaction was a file with the same name, same size, and same date.

    Then I found an article, in a forum I think, but lost the reference, that a WIN 10 update in 2021 broke the link to the reference needed here. I really don't know how that would happen. Maybe this triggers something in someone's mind. Maybe this helps in trying to repair the link.

    Thanks

  10. #10
    The Idiot
    Join Date
    Dec 2014
    Posts
    2,721

    Re: Using Word dictionary for spell check

    I use spell checking in my "game", as theres a text-editor. since its graphical it will not make any sense if I share the code.
    but here's how I do it "edited".

    Code:
    Dim wd As Object
    Dim enable As Boolean
    
    Sub InitializeWord()
        On Error Resume Next
        Set wd = CreateObject("Word.Application")
        If err.Number = 0 Then
            enable = True
            wd.Options.IgnoreMixedDigits = False
        End If
    End Sub
    
    Sub DestroyWord()
        If enable Then
            On Error Resume Next
            wd.Quit
            Set wd = Nothing
            enable = False
        End If
    End Sub
    so this two are needed to start the process. and if word doesn't exist, it will just skip it.

    Code:
    Function CheckWord(ByVal word$) As Boolean
        If enable Then
            On Error GoTo isError
            CheckWord = Not wd.CheckSpelling(word)
        End If
        Exit Function
    isError:
        InitializeWord
    End Function
    and this one I call to check "each word" if the exist or not.
    theres no grammar check. since that will lag the program.
    but its possible to do the same with grammar check as well.
    of course my code is a bit different, while "typing" Im not sending any words, this to avoid lagging,
    only when its "idle" it will check the "new" words. u should only check when needed and not everything all the time.
    the reason I have Error Check is that, if you start word and close it, it will also close the word used by VB6,
    so if that happens, I try to "re-initialize it" again.

  11. #11

    Thread Starter
    Fanatic Member AccessShell's Avatar
    Join Date
    Oct 2013
    Posts
    790

    Re: Using Word dictionary for spell check

    Thank you baka. I now get past the initial spell check. It works fine till after the check. I get the correct ans if the spelling is incorrect or correct.

    If the spelling is incorrect, my code goes in to suggest spellings. I use the following code:
    Code:
    Dim wdsp      As Word.SpellingSuggestions
    Set wdsp = wd.GetSpellingSuggestions(strBuffer)

    If the spelling is correct , my code goes on to suggest synonyms and antonyms. It then crashes on the statement
    Code:
    synList = SynonymInfo(Word:=varBuffer, LanguageID:=wdEnglishUS).SynonymList(Meaning:=1)
    and
    Code:
    antList = SynonymInfo(varBuffer, wdEnglishUS).AntonymList
    This did not happen on WIN 7
    Last edited by AccessShell; May 21st, 2022 at 11:05 AM.

  12. #12
    The Idiot
    Join Date
    Dec 2014
    Posts
    2,721

    Re: Using Word dictionary for spell check

    so it has something to do with "SynonymInfo"
    nothing I have worked on. and Im in win 7 so I can't check it for u.
    maybe someone here can help u with that. why it crashes on that function.

    just guessing.
    are there any count-values? so, u know the amount of suggestions. maybe theres none, and if so if u try to get it it will create a out of bound error. trying to get something not there in memory will always crash.

  13. #13

    Thread Starter
    Fanatic Member AccessShell's Avatar
    Join Date
    Oct 2013
    Posts
    790

    Re: Using Word dictionary for spell check

    When I run it in WIN 7, I have often gotten a count = 0. THe program still runs smoothly giving no results for suggestions.

  14. #14

    Thread Starter
    Fanatic Member AccessShell's Avatar
    Join Date
    Oct 2013
    Posts
    790

    Re: Using Word dictionary for spell check

    I found an article that references the problem. I don't fully understand it. It means messing with the registry. That's something I don't do. I may not be doing yr end updates, but the library referenced is of concern

    https://community.dynamics.com/gp/f/...g-2018-version

  15. #15

    Thread Starter
    Fanatic Member AccessShell's Avatar
    Join Date
    Oct 2013
    Posts
    790

    Re: Using Word dictionary for spell check

    OK, I guess nobody wants to read the link in the last post.

    So, this is the crux of it.

    The registry was a problem. Microsoft has a registry line for Office 365 which needs to be deleted. The macro seems to export to excel once this is done.

    I don't even know how to find out if t his line is in my registry. Can someone tell me how to do this? Can someone tell me how safe it is to do this? Can someone tell be the odds of something else negative happenning if I do this. NOTE: I am not using Office 365!

  16. #16
    The Idiot
    Join Date
    Dec 2014
    Posts
    2,721

    Re: Using Word dictionary for spell check

    my example is not using any word references directly, instead I use the CreateObject that will initiate word dynamically.
    what about if you do the same for all variables that uses word?

  17. #17

    Thread Starter
    Fanatic Member AccessShell's Avatar
    Join Date
    Oct 2013
    Posts
    790

    Re: Using Word dictionary for spell check

    baka, I thought you said you were on WIN 7. My program works just fine on WIN 7.

    I will check out your last suggestion. I thought I tried that, but I will try again.

Posting Permissions

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



Click Here to Expand Forum to Full Width