Page 3 of 3 FirstFirst 123
Results 81 to 101 of 101

Thread: Advanced VB/Office Guru™ SpellChecker™

  1. #81
    Hyperactive Member
    Join Date
    Oct 2002
    Location
    Tennessee
    Posts
    378

    Re: Advanced VB/Office Guru™ SpellChecker™

    A little too complicated for me. I think I'll just
    stick with trying to figure out how to disable the
    visualizations in Window Media Player control,
    using a button. Is there a code for that?
    I'd like to give the user an option to use it or not.
    Thanks,
    GARY

  2. #82

    Thread Starter
    Ex-Super Mod RobDog888's Avatar
    Join Date
    Apr 2001
    Location
    LA, Calif. Raiders #1 AKA:Gangsta Yoda™
    Posts
    60,710

    Re: Advanced VB/Office Guru™ SpellChecker™

    Its not hard. If you look at teh two coding examples of Early vs Late you can see the only differences are ...

    Early:
    Add a reference to Word (or whatever you are automating)


    Late:
    No reference needed
    Declare variables as Object
    Declare Constants yourself as no reference means they wont be declared

    For the WMP question, have you tried a search yet?

    Ps, dont give up so soon.
    VB/Office Guru™ (AKA: Gangsta Yoda®)
    I dont answer coding questions via PM. Please post a thread in the appropriate forum.

    Microsoft MVP 2006-2011
    Office Development FAQ (C#, VB.NET, VB 6, VBA)
    Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
    If a post has helped you then Please Rate it!
    Reps & Rating PostsVS.NET on Vista Multiple .NET Framework Versions Office Primary Interop AssembliesVB/Office Guru™ Word SpellChecker™.NETVB/Office Guru™ Word SpellChecker™ VB6VB.NET Attributes Ex.Outlook Global Address ListAPI Viewer utility.NET API Viewer Utility
    System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6

  3. #83
    Hyperactive Member
    Join Date
    Oct 2002
    Location
    Tennessee
    Posts
    378

    Re: Advanced VB/Office Guru™ SpellChecker™

    Thanks for the encouragement.
    Last edited by GARY MICHAEL; Aug 28th, 2009 at 07:57 AM.
    Thanks,
    GARY

  4. #84

    Thread Starter
    Ex-Super Mod RobDog888's Avatar
    Join Date
    Apr 2001
    Location
    LA, Calif. Raiders #1 AKA:Gangsta Yoda™
    Posts
    60,710

    Re: Advanced VB/Office Guru™ SpellChecker™

    Post up any more questions or issues you come across and we all would be happy to help.
    VB/Office Guru™ (AKA: Gangsta Yoda®)
    I dont answer coding questions via PM. Please post a thread in the appropriate forum.

    Microsoft MVP 2006-2011
    Office Development FAQ (C#, VB.NET, VB 6, VBA)
    Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
    If a post has helped you then Please Rate it!
    Reps & Rating PostsVS.NET on Vista Multiple .NET Framework Versions Office Primary Interop AssembliesVB/Office Guru™ Word SpellChecker™.NETVB/Office Guru™ Word SpellChecker™ VB6VB.NET Attributes Ex.Outlook Global Address ListAPI Viewer utility.NET API Viewer Utility
    System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6

  5. #85
    Lively Member SNIPER.PS's Avatar
    Join Date
    Dec 2009
    Posts
    96

    Arrow Re: Advanced VB/Office Guru™ SpellChecker™

    Thanks for the code

  6. #86
    Addicted Member frozie's Avatar
    Join Date
    Apr 2010
    Posts
    146

    Re: Advanced VB/Office Guru™ SpellChecker™

    Good Work

  7. #87
    New Member
    Join Date
    Apr 2010
    Posts
    1

    Re: Advanced VB/Office Guru™ SpellChecker™

    Moring All, first time here - exciting!

    I'm trying to get this goint in Access for 2 reasons: 1. it looks awsome and I like it therfore I want to (already got the built in one working fine but you know ) 2. Acess 2007 runtime doesn't have a spell check and I need to add one.

    I've imported the code and popped it into a new module. I've already got a reference to word 11 so I'm guessing I'm in with early binding (in 2003 at the mo, work out 2007 later).

    Just running debug and had to change the mouse pointer to 11 which makes me think I should be using late binding?? Anyway, whilst debuggin, it stops at App.OleRequestPendingTimeout = 999999 with a variable not defined - I'm guessing I need to either add a reference or make a change in accordance with late binding? Not sure how though, any help would be greatly appreciated.

    Martyn

  8. #88
    New Member
    Join Date
    Feb 2006
    Location
    Cheshire
    Posts
    5

    Re: Advanced VB/Office Guru™ SpellChecker™

    I have been using this code quite successfully for some time but have now hit a problem. The scenario is a VB6.0 application using Office 2010 spell check. Sometimes it works and sometimes the users get a message stating that Spell check is currently unavailable. Below is the code from my app:

    Code:
    Public Function SpellMe(ByVal msSpell As String) As String
    
        On Error GoTo No_Bugs
    
        Dim oDoc As Word.Document
        Dim iWSE As Integer
        Dim iWGE As Integer
        Dim sReplace As String
        Dim lresp As Long
    
        If msSpell = vbNullString Then Exit Function
        InitializeMe
        
        If gDiags Then
            frmDiags.AddLine moApp.Version
        End If
        
        Select Case moApp.Version
            Case "9.0", "10.0", "11.0", "12.0", "14.0"
                Set oDoc = moApp.Documents.Add(, , 1, True)
            Case "8.0"
                Set oDoc = moApp.Documents.Add
            Case Else
                MsgBox "Unsupported Version of Word.", vbOKOnly + vbExclamation, "VB/Office Guru™ SpellChecker™"
                Exit Function
        End Select
        
        Screen.MousePointer = vbHourglass
        App.OleRequestPendingTimeout = 999999
        oDoc.Words.First.InsertBefore msSpell
        iWSE = oDoc.SpellingErrors.count
        iWGE = oDoc.GrammaticalErrors.count
        '<CHECK SPELLING AND GRAMMER DIALOG BOX>
        If iWSE > 0 Or iWGE > 0 Then
            '<HIDE MAIN WORD WINDOW>
            moApp.Visible = False
            If (moApp.WindowState = wdWindowStateNormal) Or (moApp.WindowState = wdWindowStateMaximize) Then
                moApp.WindowState = wdWindowStateMinimize
            Else
                moApp.WindowState = wdWindowStateMinimize
            End If
            '</HIDE MAIN WORD WINDOW>
            '<PREP CHECK SPELLING OPTIONS DIALOG BOX (MODIFY TO YOUR PREFERENCES)>
            moApp.Dialogs(wdDialogToolsSpellingAndGrammar).Application.options.CheckGrammarWithSpelling = True
            moApp.Dialogs(wdDialogToolsSpellingAndGrammar).Application.options.SuggestSpellingCorrections = True
            moApp.Dialogs(wdDialogToolsSpellingAndGrammar).Application.options.IgnoreUppercase = True
            moApp.Dialogs(wdDialogToolsSpellingAndGrammar).Application.options.IgnoreInternetAndFileAddresses = True
            moApp.Dialogs(wdDialogToolsSpellingAndGrammar).Application.options.IgnoreMixedDigits = False
            moApp.Dialogs(wdDialogToolsSpellingAndGrammar).Application.options.ShowReadabilityStatistics = False
            '</PREP CHECK SPELLING OPTIONS DIALOG BOX (MODIFY TO YOUR PREFERENCES)>
            '<DO ACTUAL SPELL CHECKING>
            moApp.Visible = True
            moApp.Activate
            lresp = moApp.Dialogs(wdDialogToolsSpellingAndGrammar).display
            '</DO ACTUAL SPELL CHECKING>
            If lresp < 0 Then
                moApp.Visible = True
                MsgBox "Corrections Being Updated!", vbOKOnly + vbInformation, App.ProductName
                Clipboard.Clear
                oDoc.Select
                oDoc.Range.copy
                sReplace = Clipboard.GetText(1)
                '<FIX FOR POSSIBLE EXTRA LINE BREAK AT END OF TEXT>
                If (InStrRev(sReplace, Chr(13) & Chr(10))) = (Len(sReplace) - 1) Then
                    sReplace = Mid$(sReplace, 1, Len(sReplace) - 2)
                End If
                '</FIX FOR POSSIBLE EXTRA LINE BREAK AT END OF TEXT>
                SpellMe = sReplace
            ElseIf lresp = 0 Then
                MsgBox "Spelling Corrections Have Been Canceled!", vbOKOnly + vbCritical, "VB/Office Guru™ SpellChecker"
                SpellMe = msSpell
            End If
        Else
            MsgBox "No Spelling Errors Found" & vbNewLine & "Or No Suggestions Available!", vbOKOnly + vbInformation, _
            "VB/Office Guru™ SpellChecker"
            SpellMe = msSpell
        End If
        '</CHECK SPELLING AND GRAMMER DIALOG BOX>
        oDoc.Close False
        Set oDoc = Nothing
        '<HIDE WORD IF THERE ARE NO OTHER INSTANCES>
        If KillMe = True Then
            moApp.Visible = False
        End If
        '</HIDE WORD IF THERE ARE NO OTHER INSTANCES>
        Screen.MousePointer = vbNormal
        Exit Function
    No_Bugs:
        If err.Number = "91" Then
            Resume Next
        ElseIf err.Number = "462" Then
            MsgBox "Spell Checking Is Temporary Un-Available!" & vbNewLine & "Try Again After Program Re-Start.", _
            vbOKOnly + vbInformation, "ActiveX Server Not Responding"
            Screen.MousePointer = vbNormal
        ElseIf err.Number = 429 Then
            Set moApp = Nothing
            Resume Next
        Else
            MsgBox err.Number & " " & err.Description, vbOKOnly + vbInformation, App.ProductName
            Screen.MousePointer = vbNormal
        End If
    End Function
    Any help would be greatly appreciated.

    Thanks.
    Last edited by RobDog888; Jul 15th, 2011 at 11:51 AM. Reason: Added [code] tags

  9. #89

    Thread Starter
    Ex-Super Mod RobDog888's Avatar
    Join Date
    Apr 2001
    Location
    LA, Calif. Raiders #1 AKA:Gangsta Yoda™
    Posts
    60,710

    Re: Advanced VB/Office Guru™ SpellChecker™

    I dont have 2010 installed on my work computer but have you tried stepping through the code to see where the hangup lies?
    VB/Office Guru™ (AKA: Gangsta Yoda®)
    I dont answer coding questions via PM. Please post a thread in the appropriate forum.

    Microsoft MVP 2006-2011
    Office Development FAQ (C#, VB.NET, VB 6, VBA)
    Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
    If a post has helped you then Please Rate it!
    Reps & Rating PostsVS.NET on Vista Multiple .NET Framework Versions Office Primary Interop AssembliesVB/Office Guru™ Word SpellChecker™.NETVB/Office Guru™ Word SpellChecker™ VB6VB.NET Attributes Ex.Outlook Global Address ListAPI Viewer utility.NET API Viewer Utility
    System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6

  10. #90
    New Member
    Join Date
    Feb 2006
    Location
    Cheshire
    Posts
    5

    Re: Advanced VB/Office Guru™ SpellChecker™

    It fails at Set oDoc = moApp.Documents.Add(, , 1, True) in that at the next step it says "the action cannot be performed as no document is open" or "Spell Check is currently unavailable". As far as Word 2010 goes it isn't just affecting this Spell Check code but everywhere I need to automate Word.

    Thanks

  11. #91
    Junior Member
    Join Date
    Aug 2010
    Posts
    19

    Re: Advanced VB/Office Guru™ SpellChecker™

    Rob,
    I reworked your code into a "drop in" class module that does it's own initializing and termination, negating the user doing so in their form code. I also added some extra properties and events. Your copyright suggests I should ask permission before posting it here. Would it be okay to do so?

    Thanks!

    - Kev

  12. #92
    Junior Member
    Join Date
    Aug 2010
    Posts
    19

    Re: Advanced VB/Office Guru™ SpellChecker™

    Hopefully this thread is still being followed? Maybe?

    I discovered something in your sample that doesn't make sense, and damned if I can find the answer in MSFT's docs.

    If you change the CheckGrammarWithSpelling option to false, and click Cancel on the Dialog, lResp returns -1 (versus 0 for Cancel/Close). Switching it back to True restores normal behaviour.

    So, any idea why that might be?

    I'm tossing around checking the spelling errors count for something > 0 as clicking Cancel does not lower the error count like Ignore does.

  13. #93

    Thread Starter
    Ex-Super Mod RobDog888's Avatar
    Join Date
    Apr 2001
    Location
    LA, Calif. Raiders #1 AKA:Gangsta Yoda™
    Posts
    60,710

    Re: Advanced VB/Office Guru™ SpellChecker™

    If memory servers me right, the calcel/close values are not self explainatory. There is also a third value -2 which means something too.

    I will dig up my old files and see what somments I have from r n d.
    VB/Office Guru™ (AKA: Gangsta Yoda®)
    I dont answer coding questions via PM. Please post a thread in the appropriate forum.

    Microsoft MVP 2006-2011
    Office Development FAQ (C#, VB.NET, VB 6, VBA)
    Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
    If a post has helped you then Please Rate it!
    Reps & Rating PostsVS.NET on Vista Multiple .NET Framework Versions Office Primary Interop AssembliesVB/Office Guru™ Word SpellChecker™.NETVB/Office Guru™ Word SpellChecker™ VB6VB.NET Attributes Ex.Outlook Global Address ListAPI Viewer utility.NET API Viewer Utility
    System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6

  14. #94
    Junior Member
    Join Date
    Aug 2010
    Posts
    19

    Re: Advanced VB/Office Guru™ SpellChecker™

    Rob -

    The MSDN says the following (http://msdn.microsoft.com/en-us/libr...g.display.aspx)

    -2 = The Close button.

    -1 = The OK button.

    0 (zero) = The Cancel button.

    > 0 (zero) = A command button: 1 is the first button, 2 is the second button, and so on.

    My observation is, based on the Grammar check set to false is the return value is always -1, regardless what button is clicked. Odd behaviour to say the least (but with MSFT, this is typically the norm, especially when ti comes to automating various office classes). As I noted before, I was able to compensate for this by checking for unchecked errors after the user cancels out. Couldn't figure out why the return value is so flaky, so...

    I'd still like to get your permission to post my class based on your code. I think you'd find the enhancements nod worthy. ;-)

  15. #95
    Registered User
    Join Date
    May 2013
    Posts
    2

    Re: Advanced VB/Office Guru™ SpellChecker™

    Today i have also come up with the same problem. Everything works fine but when you try to use Word 2010, it gives the following error. However my error description is slightly different
    4605 The Add method or property is not available because the document is a rich text edit control.

  16. #96
    Registered User
    Join Date
    May 2013
    Posts
    2

    Re: Advanced VB/Office Guru™ SpellChecker™

    Quote Originally Posted by abbid_siddiqui View Post
    Today i have also come up with the same problem. Everything works fine but when you try to use Word 2010, it gives the following error. However my error description is slightly different
    4605 The Add method or property is not available because the document is a rich text edit control.
    I've found out the reason for this problem but don't have any idea how to resolve this? The error occurs when there is an unclosed instance of Spell Checker in the Task Manager (don't know why it remains in task manager). If you close that and re-run the application, it works.
    Rob, could you please let me know how to avoid this error?

  17. #97
    Frenzied Member
    Join Date
    Apr 2012
    Posts
    1,253

    Re: Advanced VB/Office Guru™ SpellChecker™

    Quote Originally Posted by RobDog888 View Post
    I wrote this to demonstrate how to take full advantage of MS Word's built in Spelling and Grammer checker
    Oh, the irony...
    If you don't know where you're going, any road will take you there...

    My VB6 love-children: Vee-Hive and Vee-Launcher

  18. #98
    New Member
    Join Date
    Mar 2023
    Posts
    1

    Re: Advanced VB/Office Guru™ SpellChecker™

    I know this is an old thread but we recently starting having issues where the word that is misspelled is no longer being displayed in the 'Not in Dictionary' portion of the spell checker. I have created a new project from RobDog888 example in this thread and that is doing the same thing. Anyone else experiencing this and/or have suggestions on how to get it to display the misspelled word again? I suspect it is a MS change/update to office.

    Here is an example. Thanks!

    Attachment 187199

  19. #99
    MS SQL Powerposter szlamany's Avatar
    Join Date
    Mar 2004
    Location
    Connecticut
    Posts
    18,263

    Re: Advanced VB/Office Guru™ SpellChecker™

    Quote Originally Posted by ColinE66 View Post
    Oh, the irony...
    Lol!

    *** Read the sticky in the DB forum about how to get your question answered quickly!! ***

    Please remember to rate posts! Rate any post you find helpful - even in old threads! Use the link to the left - "Rate this Post".

    Some Informative Links:
    [ SQL Rules to Live By ] [ Reserved SQL keywords ] [ When to use INDEX HINTS! ] [ Passing Multi-item Parameters to STORED PROCEDURES ]
    [ Solution to non-domain Windows Authentication ] [ Crazy things we do to shrink log files ] [ SQL 2005 Features ] [ Loading Pictures from DB ]

    MS MVP 2006, 2007, 2008

  20. #100

    Thread Starter
    Ex-Super Mod RobDog888's Avatar
    Join Date
    Apr 2001
    Location
    LA, Calif. Raiders #1 AKA:Gangsta Yoda™
    Posts
    60,710

    Re: Advanced VB/Office Guru™ SpellChecker™

    Quote Originally Posted by ColinE66 View Post
    Oh, the irony...
    Yup! Testing you guys to see if anyone notices.
    VB/Office Guru™ (AKA: Gangsta Yoda®)
    I dont answer coding questions via PM. Please post a thread in the appropriate forum.

    Microsoft MVP 2006-2011
    Office Development FAQ (C#, VB.NET, VB 6, VBA)
    Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
    If a post has helped you then Please Rate it!
    Reps & Rating PostsVS.NET on Vista Multiple .NET Framework Versions Office Primary Interop AssembliesVB/Office Guru™ Word SpellChecker™.NETVB/Office Guru™ Word SpellChecker™ VB6VB.NET Attributes Ex.Outlook Global Address ListAPI Viewer utility.NET API Viewer Utility
    System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6

  21. #101
    INXSIVE Bruce Fox's Avatar
    Join Date
    Sep 2001
    Location
    Melbourne, Australia
    Posts
    7,428

    Re: Advanced VB/Office Guru™ SpellChecker™

    I noticed!

Page 3 of 3 FirstFirst 123

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