Page 2 of 3 FirstFirst 123 LastLast
Results 41 to 80 of 101

Thread: Advanced VB/Office Guru™ SpellChecker™

  1. #41

    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™

    Early binding:
    Add a reference to MS Word xx.0 Object Library

    It may be possible to catch spelling mistakes as you type but it would need calls to spellcheck after each keypress. What do you mean "external textboxes"? Not your program but someone elses? If so that would also be possible but not something that would be very easy.
    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

  2. #42
    Fanatic Member aconybeare's Avatar
    Join Date
    Oct 2001
    Location
    UK
    Posts
    772

    Re: Advanced VB/Office Guru™ SpellChecker™

    RobDog, Martin,

    Did you ever get this converted or working with the vb-forum tool?

    Cheers Al

  3. #43

    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™

    No I didnt at least but I did start working on writting an AddOn for IE7
    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

  4. #44
    Fanatic Member aconybeare's Avatar
    Join Date
    Oct 2001
    Location
    UK
    Posts
    772

    Re: Advanced VB/Office Guru™ SpellChecker™

    Hi,

    I've attempted to translate this code into vbscript for use with the vb-world forum tool

    Can be easily altered to be used with regular web forms

    Cheers Al

  5. #45
    Addicted Member
    Join Date
    May 2005
    Location
    USA Washington
    Posts
    191

    Re: Advanced VB/Office Guru™ SpellChecker™

    Hi, I just have one question. Is there a way to have spellcheck, but just like do it all in the background. like have a array of words to either check (true and keep) or don't (false and throw-out) If this thread is too old or something and I'm posting on a dead thread, just tell me. I'm not sure what the rules are on all that. Thanks

  6. #46

    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™

    The thread is still alive lol.

    Yes, you can get the spelling suggestions with the GetSpellingSuggestions function which returns a collection of possible spelling replacements.
    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

  7. #47
    Addicted Member
    Join Date
    May 2005
    Location
    USA Washington
    Posts
    191

    Re: Advanced VB/Office Guru™ SpellChecker™

    One more thing. if you would. maybe this should go somewhere else. but anyway. I saw the reference I needed but now I've found out I need to link it. and I'm not sure how I am to go about this. (never done it before)

  8. #48
    Addicted Member
    Join Date
    May 2005
    Location
    USA Washington
    Posts
    191

    Re: Advanced VB/Office Guru™ SpellChecker™

    I'm trying to use your module and then use moApp.Checkspelling("ttest")
    and I don't know why but it says that:

    Run-time error '91':

    Object variable or with block variable not set
    //
    I don't understand.

  9. #49

    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™

    Are you calling the InitializeMe procedure first anywhere in your app?
    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. #50
    Hyperactive Member
    Join Date
    Jun 2003
    Location
    Manchester, CT
    Posts
    317

    Re: Advanced VB/Office Guru™ SpellChecker™

    Awsome code, but im havnig an issue where it closes all isntances of word... if I am working on a word document, it closes without asking me, and it shows an additional document that shows the text it is spell checking... odd
    "I dont even see the code anymore... I just see Blonde, Brunette, Redhead..."

  11. #51

    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™

    Thanks

    Place a breakpoint on the InitializeMe sub and check if the mbKillMe flag is True or False when you do have Word already running.
    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

  12. #52
    Learning .Net danasegarane's Avatar
    Join Date
    Aug 2004
    Location
    VBForums
    Posts
    5,853

    Re: Advanced VB/Office Guru™ SpellChecker™

    VB Code:
    1. 'Add a reference to MS Word xx.0 Object Library
    2. '1.Select Project From the tools menu
    3. '2.Select Reference ,In the shown dialog box, tick the check box before
    4.  '  Microsoft Word x.x object Library.
    5. '3.Run the project
    Please mark you thread resolved using the Thread Tools as shown

  13. #53
    New Member
    Join Date
    Jan 2007
    Posts
    3

    Re: Advanced VB/Office Guru™ SpellChecker™

    I'm wondering if you can help me out. Here is my version of the spell check code. In random occasions, I would encounter "Run-time error '462'". I looked it up on http://support.microsoft.com/kb/189618, and it seems to indicate that VB did not release the reference to word, and it interferes with automation code when the code is run more than once.

    I have played around with the code to resolve the issue, but I'm out of ideas. I have even tried running some "throw-exceptions" at the end, but the code won't recognize the error number.

    This issue does not happen all the time, but it seems to happen intermittantly at random times. I am wondering if any of you have had experience with this.

    The following is my code and thanks for your help!

    VB Code:
    1. Public moApp As Object
    2. Private mbKillMe As Boolean
    3.  
    4. Public Property Get KillMe() As Boolean
    5.     InitializeMe
    6.     KillMe = mbKillMe
    7. End Property
    8.  
    9. Public Property Let KillMe(Value As Boolean)
    10.     mbKillMe = Value
    11. End Property
    12.  
    13. Public Sub InitializeMe()
    14.     On Error Resume Next
    15.     Set moApp = GetObject(, "Word.Application")
    16.     If TypeName(moApp) <> "Nothing" Then
    17.         Set moApp = GetObject(, "Word.Application")
    18.     Else
    19.         Set moApp = CreateObject("Word.Application")
    20.         mbKillMe = True
    21.     End If
    22. End Sub
    23.  
    24. Public Function SpellMe(ByVal msSpell As String) As String
    25.  
    26.     On Error GoTo No_Bugs
    27.  
    28.     Dim oDoc As Object 'Word.Document
    29.     Dim iWSE As Integer
    30.     Dim iWGE As Integer
    31.     Dim sReplace As String
    32.     Dim lResp As Long
    33.  
    34.     If msSpell = vbNullString Then Exit Function
    35.     InitializeMe
    36.     Select Case moApp.Version
    37.         Case "9.0", "10.0", "11.0"
    38.             Set oDoc = moApp.Documents.Add(, , 1, True)
    39.         Case "8.0"
    40.             Set oDoc = moApp.Documents.Add
    41.         Case Else
    42.             MsgBox "Unsupported Version of Word.", vbOKOnly + vbExclamation, "VB/Office Guru™ SpellChecker™"
    43.             SpellMe = msSpell
    44.             Exit Function
    45.     End Select
    46.     Screen.MousePointer = vbHourglass
    47.     App.OleRequestPendingTimeout = 999999
    48.     oDoc.Words.First.InsertBefore msSpell
    49.     iWSE = oDoc.SpellingErrors.Count
    50.     iWGE = oDoc.GrammaticalErrors.Count
    51.    
    52.     If iWSE > 0 Or iWGE > 0 Then
    53.         moApp.Assistant.On = False
    54.         moApp.Visible = False
    55.         If (moApp.WindowState = 0) Or (moApp.WindowState = 1) Then
    56.             moApp.WindowState = 2
    57.         Else
    58.             moApp.WindowState = 2
    59.         End If
    60.         moApp.Dialogs(828).Application.Options.CheckGrammarWithSpelling = True
    61.         moApp.Dialogs(828).Application.Options.SuggestSpellingCorrections = True
    62.         moApp.Dialogs(828).Application.Options.IgnoreUppercase = True
    63.         moApp.Dialogs(828).Application.Options.IgnoreInternetAndFileAddresses = True
    64.         moApp.Dialogs(828).Application.Options.IgnoreMixedDigits = False
    65.         moApp.Dialogs(828).Application.Options.ShowReadabilityStatistics = False
    66.         moApp.Visible = True
    67.         moApp.Activate
    68.         lResp = moApp.Dialogs(828).Display
    69.         If lResp < 0 Then
    70.             moApp.Visible = True
    71.             MsgBox "Corrections Being Updated!", vbOKOnly + vbInformation, App.ProductName
    72.             Clipboard.Clear
    73.             oDoc.Select
    74.             oDoc.Range.Copy
    75.             sReplace = Clipboard.GetText(1)
    76.             If (InStrRev(sReplace, Chr(13) & Chr(10))) = (Len(sReplace) - 1) Then
    77.                 sReplace = Mid$(sReplace, 1, Len(sReplace) - 2)
    78.             End If
    79.             SpellMe = sReplace
    80.         ElseIf lResp = 0 Then
    81.             MsgBox "Spelling Corrections Have Been Canceled!", vbOKOnly + vbCritical, "VB/Office Guru™ SpellChecker"
    82.             SpellMe = msSpell
    83.         End If
    84.     Else
    85.         MsgBox "No Spelling Errors Found" & vbNewLine & "Or No Suggestions Available!", vbOKOnly + vbInformation, _
    86.         "VB/Office Guru™ SpellChecker"
    87.         SpellMe = msSpell
    88.     End If
    89.     oDoc.Close False
    90.     Set oDoc = Nothing
    91.     If KillMe = True Then
    92.         moApp.Visible = False
    93.     End If
    94.     Screen.MousePointer = vbNormal
    95.     Exit Function
    96. No_Bugs:
    97.     If Err.Number = "91" Then
    98.         SpellMe = msSpell
    99.         Resume Next
    100.     ElseIf Err.Number = "462" Then
    101.         SpellMe = msSpell
    102.         MsgBox "Spell Checking Is Temporary Un-Available!" & vbNewLine & "Make sure an e-mail message is not open.", _
    103.         vbInformation, "ActiveX Server Not Responding"
    104.         Screen.MousePointer = vbNormal
    105.     ElseIf Err.Number = 429 Then
    106.         SpellMe = msSpell
    107.         Set moApp = Nothing
    108.         Resume Next
    109.     Else
    110.         SpellMe = msSpell
    111.         MsgBox Err.Number & " " & Err.Description, vbOKOnly + vbInformation, App.ProductName
    112.         Screen.MousePointer = vbNormal
    113.     End If
    114. End Function

  14. #54

    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™

    Without getting into it yet, only have limited time, have you checked to see if on those systems where you get the error if they have Outlook open and if so does it use Word as its default email editor. If it does and they have an email message open it may be being used by my spell check code as the open instance. So when they close an email its closing word and geting the 462 error.
    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

  15. #55
    New Member
    Join Date
    Jan 2007
    Posts
    3

    Re: Advanced VB/Office Guru™ SpellChecker™

    That was one of the tests I did. I was getting the error without having outlook open.

  16. #56

    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™

    But did you have any email messages open either? You can have an email open without having Outlook fully open.

    Also, did you check the status in the InitializeMe() sub? What is the value of mbKillMe at the end of the sub?
    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

  17. #57
    New Member
    Join Date
    Jan 2007
    Posts
    3

    Re: Advanced VB/Office Guru™ SpellChecker™

    good advice rob.

    I'll be monitoring the status of mbKillMe. This issue happens intermittantly, so I'll have to keep testing it and wait for it to pop up.

    Thanks for the help.

  18. #58
    Hyperactive Member
    Join Date
    Oct 2006
    Posts
    354

    Re: Advanced VB/Office Guru™ SpellChecker™

    VB Code:
    1. 'VB.net 2005
    2. 'Based on example fro another site, However modified.
    3. 'The example simple moved the Application off the screen which did not work well if Word every crashed during a spell check because it would start off the screen.
    4. 'This uses this example of WdWindowState.wdWindowStateMinimize
    5.  
    6. Imports System.Runtime.InteropServices
    7. Imports Word
    8. 'Imports Microsoft.Office.Interop.Word
    9.  
    10.  
    11. Public Class SpellCheck
    12.  
    13.     Inherits System.Windows.Forms.Form
    14.  
    15.     ' Invokes either the spell or grammar checker.  
    16.     Private Sub SpellOrGrammarCheck(ByVal blnSpellOnly As Boolean)
    17.         Try
    18.             ' Create Word and temporary document objects.
    19.             Dim objWord As Word.Application
    20.             Dim objTempDoc As Object
    21.             ' Declare an IDataObject to hold the data returned from the
    22.             ' clipboard.
    23.             Dim iData As IDataObject
    24.  
    25.             ' If there is no data to spell check, then exit sub here.
    26.             If TextBox1.Text = "" Then
    27.                 Exit Sub
    28.             End If
    29.             objWord = New Word.Application
    30.             'objWord = New Microsoft.Office.Interop.Word.Application
    31.             objTempDoc = objWord.Documents.Add
    32.             objWord.Visible = False
    33.  
    34.             'Minimze word
    35.  
    36.             If (objWord.ActiveWindow.WindowState <> WdWindowState.wdWindowStateMinimize) Then
    37.                 objWord.ActiveWindow.WindowState = WdWindowState.wdWindowStateMinimize
    38.             End If
    39.  
    40.  
    41.  
    42.             ' Copy the contents of the textbox to the clipboard
    43.             Clipboard.SetDataObject(TextBox1.Text)
    44.  
    45.             ' With the temporary document, perform either a spell check or a
    46.             ' complete
    47.             ' grammar check, based on user selection.
    48.             With objTempDoc
    49.                 .Content.Paste()
    50.                 .Activate()
    51.                 If blnSpellOnly Then
    52.                     .CheckSpelling()
    53.                 Else
    54.                     .CheckGrammar()
    55.                 End If
    56.  
    57.  
    58.                 ' After user has made changes, use the clipboard to
    59.                 ' transfer the contents back to the text box
    60.                 .Content.Copy()
    61.                 iData = Clipboard.GetDataObject
    62.                 If iData.GetDataPresent(DataFormats.Text) Then
    63.                     TextBox1.Text = CType(iData.GetData(DataFormats.Text), _
    64.                         String)
    65.                 End If
    66.  
    67.                 .Saved = True
    68.                 .Close()
    69.             End With
    70.  
    71.  
    72.             objWord.Quit()
    73.  
    74.             'MessageBox.Show("The spelling check is complete.", _
    75.             '    "Spell Checker", MessageBoxButtons.OK, _
    76.             '    MessageBoxIcon.Information)
    77.  
    78.             ' Microsoft Word must be installed.
    79.         Catch COMExcep As Runtime.InteropServices.COMException
    80.             MessageBox.Show( _
    81.                 "Microsoft Word must be installed for Spell/Grammar Check " _
    82.                 & "to run.", "Spell Checker")
    83.  
    84.         Catch Excep As Exception
    85.             MessageBox.Show("An error has occured.", "Spell Checker")
    86.  
    87.         End Try
    88.  
    89.     End Sub
    90.  
    91.     Private Sub btnSpellCheck_Click(ByVal sender As System.Object, _
    92.         ByVal e As System.EventArgs) Handles btnSpellCheck.Click
    93.         SpellOrGrammarCheck(True)
    94.     End Sub
    95.  
    96.     'Private Sub btnGrammarCheck_Click(ByVal sender As System.Object, _
    97.     '   ByVal e As System.EventArgs) Handles btnGrammarCheck.Click
    98.     '   SpellOrGrammarCheck(False)
    99.     'End Sub
    100.  
    101.  
    102.  
    103. End Class

  19. #59

    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™

    Yes, I do have a VB.NET version of my code too:
    http://www.vbforums.com/showthread.php?t=359879
    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

  20. #60
    New Member
    Join Date
    Mar 2002
    Posts
    14

    Re: Advanced VB/Office Guru™ SpellChecker™

    Quote Originally Posted by RobDog888
    Thats not in my code example but it loks like your missing a class or control in your project.

    Is it possible to get those red underlines on error words detected using this spell checker?
    -scmay-

  21. #61

    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™

    The Word Object Model doesnt expose that exact wavy underlinning but it does have a close similar match.

    Specify the wdUnderlineWavy and .UnderlineColor to best duplicate the spellchecking spelling error identifier. Its very close.

    This is in Word 2007 so I cant say its in the previous versions.

    Code:
    Selection.Font.Underline = wdUnderlineWavy
    Selection.Font.UnderlineColor = wdColorRed
    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

  22. #62
    New Member
    Join Date
    Mar 2002
    Posts
    14

    Re: Advanced VB/Office Guru™ SpellChecker™

    Hi RobDog888,

    For some reason when I implement your code in the system accessing localhost database it works fine, however when it is using the server database the spellcheck functionality does not function. I know it is still accessing and opening MS Word (because the temp files in MS Word keep increasing invisibly, when you open a new MS Word you realize the instance has incremented), but I am not sure how to fix this...or why this should happen.
    -scmay-

  23. #63
    New Member
    Join Date
    Oct 2007
    Posts
    2

    Re: Advanced VB/Office Guru™ SpellChecker™

    I am using the code in an access 2000 database. I have a richtextbox using it as a mini-word application. When I run the code it says the spelling is complete (no spelling errors) but it's clear that I do have them. I will just type in a bunch of letters and it passes.

    I noticed then in word it would do the same thing, I had to delete the custom.dic file to get word correctly working again with the default dictionary. However the problem still presists in my application.

    Has anyone got this working in an access or richtextbox environment?

  24. #64
    New Member
    Join Date
    Oct 2007
    Posts
    2

    Re: Advanced VB/Office Guru™ SpellChecker™

    For RichTextBoxes I found another piece of code that works much better. Create a button and put this in the code. RTFText is the name of your RichTextBox. I'm using this in Access 2000 and it is working great.

    Code:
    On Error GoTo SpellCheckErr
    	Dim oWord As Object
    
    	Set oWord = CreateObject("Word.Application")
    
    	'Save the RTF Box contents to a temporary file
    	rtfText.SaveFile "C:\TEST.RTF", rtfRTF
    
    	'Open the saved document and spellcheck it
    	oWord.Documents.Open ("C:\TEST.RTF")
    	oWord.ActiveDocument.SpellingChecked = False
    	oWord.Options.IgnoreUppercase = False
    	oWord.ActiveDocument.CheckSpelling
    
    	'Save the changes to the RTF file & close
    	oWord.ActiveDocument.Save
    	oWord.ActiveDocument.Close
    	oWord.Quit
    
    	'Load the changes back to the rtf text box.
    	rtfText.LoadFile "C:\TEST.RTF", rtfRTF
    
    	Set oWord = Nothing
    	Screen.MousePointer = vbDefault
    	MsgBox "Spell Check is complete", _
    		vbInformation, "Spell Check"
    	Exit Sub
    
    SpellCheckErr:
    	MsgBox Err.Description, vbCritical, _
    		"Spell Check"
    	Set oWord = Nothing

  25. #65

    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™

    You may run into issues with different OS' and permissions to write a file to a particular directory.
    For ex. in Vista writting to the root drive is locked down and prohibited. This wopuld mean writting to some other location and dont think that yoiu could use the Program Files directory as that is locked down too. )
    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

  26. #66
    New Member
    Join Date
    Dec 2007
    Posts
    1

    Re: Advanced VB/Office Guru™ SpellChecker™

    In your code for spelling and grammer checking, is there a way to hide the Check Grammer checkbox on the Spelling and Grammer dialog? I want to force the user to have both spelling and grammer checked without providing the option to disable the grammer checking. Also, is there a way to disable the Options button on the Spelling and Grammer dialog?
    Last edited by bikertz; Dec 12th, 2007 at 04:11 PM.

  27. #67
    Fanatic Member
    Join Date
    May 2007
    Posts
    788

    Re: Advanced VB/Office Guru™ SpellChecker™

    Finally, which code I can use in my VB6 program for spell-check? Please help me out.

    Thanks.

  28. #68

    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 VBLearner6
    Finally, which code I can use in my VB6 program for spell-check? Please help me out.

    Thanks.
    Whats your question/issue?
    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

  29. #69

    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 bikertz
    In your code for spelling and grammer checking, is there a way to hide the Check Grammer checkbox on the Spelling and Grammer dialog? I want to force the user to have both spelling and grammer checked without providing the option to disable the grammer checking. Also, is there a way to disable the Options button on the Spelling and Grammer dialog?
    To modify any control on Words spell checker dialog (other then prepopulating it) you would need to use a C++ dll to subclass Word and modify the dialog via APIs. A bit of work but can be done.
    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

  30. #70
    New Member
    Join Date
    Nov 2008
    Posts
    4

    Re: Advanced VB/Office Guru™ SpellChecker™

    Hi guys, thank you for this great thread. I am using Visual Basic 2005.

    I have code similar to this and the spell checker is working.

    The problem I am having is if the user brings up the spell checker dialog window and then switches to another application and then alt-tabs back to my application, things freeze up.

    The user can alt-tab back to the Word dialog box and close it, but if he tries to go directly to the application it freezes.

    Does the line: "App.OleRequestPendingTimeout = 999999" prevent this freezing, and if not is there another way to fix this?

    Thanks again

  31. #71
    New Member
    Join Date
    Nov 2008
    Posts
    4

    Re: Advanced VB/Office Guru™ SpellChecker™

    Didn't realize above message saved, srry for the double post
    Last edited by zepar; Nov 28th, 2008 at 07:46 AM.

  32. #72

    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™

    No prob and Thanks

    Since you are using .NET you should be using something similar to my VB.NET version:
    http://www.vbforums.com/showthread.php?t=359879

    In .NET perhaps creating a separate thread to process the spellchecking may solve the siiue

    I'm working on a new updated version and shold be ready 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

  33. #73
    New Member
    Join Date
    Nov 2008
    Posts
    4

    Re: Advanced VB/Office Guru™ SpellChecker™

    I tried the code and am still having the freezing issue when the user tabs out to another app and then back to my app while the spellchecker is still running, so I put in a workaround where I will show Word in the task bar below and they can click on that to get back to the spellchecker and avoid freezing.

    Thanks again for your help

  34. #74

    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™

    No prob.

    What version of Word are you using so we can track any issues with a particular version?
    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

  35. #75
    New Member
    Join Date
    Nov 2008
    Posts
    4

    Re: Advanced VB/Office Guru™ SpellChecker™

    Word 2003 (Word 11.5604.8202)

  36. #76
    Hyperactive Member
    Join Date
    Oct 2002
    Location
    Tennessee
    Posts
    378

    Re: Advanced VB/Office Guru™ SpellChecker™

    Hello,

    I tried this code and got this error.

    Code:
    Error: User defined type not defined.
    
    Public moApp As Word.Application
    I copied and pasted your code to a module then
    I cut the bottom part and pasted it into a form.

    Where did I go wrong?
    Thanks,
    GARY

  37. #77
    Super Moderator si_the_geek's Avatar
    Join Date
    Jul 2002
    Location
    Bristol, UK
    Posts
    41,930

    Re: Advanced VB/Office Guru™ SpellChecker™

    Rather than just copy+paste code from somewhere, you should at least read the comments at the top of it:
    Code:
    'Early binding:
    'Add a reference to MS Word xx.0 Object Library
    'Modifications: none.
     
    'Late binding:
    'No references needed to any version of Word
    'Modifications: Change object vars definitions (moApp & oDoc) to Object
    'Change constants to their numeric equilivalents.

  38. #78

    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™

    You are better off using Late Binding as I remember reading your Word Processor thread.
    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

  39. #79
    Hyperactive Member
    Join Date
    Oct 2002
    Location
    Tennessee
    Posts
    378

    Re: Advanced VB/Office Guru™ SpellChecker™

    I did read the notes and still didn't know what it meant.
    If I had examples of binding or whatever, it would help. I
    could then figure out what does what.
    Thanks,
    GARY

  40. #80

    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™

    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

Page 2 of 3 FirstFirst 123 LastLast

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