PHP User Warning: fetch_template() calls should be replaced by the vB_Template class. Template name: bbcode_highlight in ..../includes/functions.php on line 4197

PHP User Warning: fetch_template() calls should be replaced by the vB_Template class. Template name: bbcode_highlight in ..../includes/functions.php on line 4197

PHP User Warning: fetch_template() calls should be replaced by the vB_Template class. Template name: bbcode_highlight in ..../includes/functions.php on line 4197

PHP User Warning: fetch_template() calls should be replaced by the vB_Template class. Template name: bbcode_highlight in ..../includes/functions.php on line 4197

PHP User Warning: fetch_template() calls should be replaced by the vB_Template class. Template name: bbcode_highlight in ..../includes/functions.php on line 4197

PHP User Warning: fetch_template() calls should be replaced by the vB_Template class. Template name: bbcode_highlight in ..../includes/functions.php on line 4197

PHP User Warning: fetch_template() calls should be replaced by the vB_Template class. Template name: bbcode_highlight in ..../includes/functions.php on line 4197

PHP User Warning: fetch_template() calls should be replaced by the vB_Template class. Template name: bbcode_highlight in ..../includes/functions.php on line 4197
Advanced VB/Office Guru™ SpellChecker™-VBForums
Page 1 of 3 123 LastLast
Results 1 to 40 of 97

Thread: Advanced VB/Office Guru™ SpellChecker™

  1. #1

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

    Arrow Advanced VB/Office Guru™ SpellChecker™

    Gangsta Yoda

    Description:
    I wrote this to demonstrate how to take full advantage of MS Word's built in Spelling and Grammer checker. There
    are a few other code examples that show how to do spell checking with Word but they are all using the same technique that
    seems to have a few issues like showing the spell dialog behind your app, messing up the line breaks so you need to
    apply a code fix to restore them, flashing window, etc.

    What makes my spell checker different is that I use the actual spell/grammer checking dialog window and not invoking it by
    coding the usual - "Document.CheckSpelling" which seems to cause the mentioned issues.

    Since I use the dialog window I preset the type of spelling I wish to perform. Now you can make it dynamic by having a
    spell options form in your app to allow the user to preset it to either Ignore words in UPPERCASE, urls, mixed words and
    numbers, check grammer, and whether to show spelling suggestions, etc.

    Requirements:
    Microsoft Word
    Versions 8.0 - 11.0 (97 - 2003)


















    VB Code:
    1. 'In a module (Module1.bas)
    2. Option Explicit
    3. 'Copyright © 2005 by RobDog888 (VB/Office Guru™). All Rights reserved.
    4. '
    5. 'Distribution: You can freely use this code in your own
    6. '              applications provided that this copyright
    7. '              is left unchanged, but you may not reproduce
    8. '              or publish this code on any web site, online
    9. '              service, or distribute as source on any
    10. '              media without express permission.
    11. '
    12. 'Early binding:
    13. 'Add a reference to MS Word xx.0 Object Library
    14. 'Modifications: none.
    15.  
    16. 'Late binding:
    17. 'No references needed to any version of Word
    18. 'Modifications: Change object vars definitions (moApp & oDoc) to Object
    19. 'Change constants to their numeric equilivalents.
    20.  
    21. 'Requirements:
    22. 'MS Word version 97 (8.0) - 2003 (11.0)
    23.  
    24. Public moApp As Word.Application
    25. Private mbKillMe As Boolean
    26.  
    27. Public Property Get KillMe() As Boolean
    28.     InitializeMe
    29.     KillMe = mbKillMe
    30. End Property
    31.  
    32. Public Property Let KillMe(Value As Boolean)
    33.     mbKillMe = Value
    34. End Property
    35.  
    36. Public Sub InitializeMe()
    37.     On Error Resume Next
    38.     '<INITIALIZE WORD>
    39.     Set moApp = GetObject(, "Word.Application")
    40.     If TypeName(moApp) <> "Nothing" Then
    41.         Set moApp = GetObject(, "Word.Application")
    42.     Else
    43.         Set moApp = CreateObject("Word.Application")
    44.         mbKillMe = True
    45.     End If
    46. End Sub
    47.  
    48. Public Function SpellMe(ByVal msSpell As String) As String
    49.  
    50.     On Error GoTo No_Bugs
    51.  
    52.     Dim oDoc As Word.Document
    53.     Dim iWSE As Integer
    54.     Dim iWGE As Integer
    55.     Dim sReplace As String
    56.     Dim lResp As Long
    57.  
    58.     If msSpell = vbNullString Then Exit Function
    59.     InitializeMe
    60.     Select Case moApp.Version
    61.         Case "9.0", "10.0", "11.0"
    62.             Set oDoc = moApp.Documents.Add(, , 1, True)
    63.         Case "8.0"
    64.             Set oDoc = moApp.Documents.Add
    65.         Case Else
    66.             MsgBox "Unsupported Version of Word.", vbOKOnly + vbExclamation, "VB/Office Guru™ SpellChecker™"
    67.             Exit Function
    68.     End Select
    69.     Screen.MousePointer = vbHourglass
    70.     App.OleRequestPendingTimeout = 999999
    71.     oDoc.Words.First.InsertBefore msSpell
    72.     iWSE = oDoc.SpellingErrors.Count
    73.     iWGE = oDoc.GrammaticalErrors.Count
    74.     '<CHECK SPELLING AND GRAMMER DIALOG BOX>
    75.     If iWSE > 0 Or iWGE > 0 Then
    76.         '<HIDE MAIN WORD WINDOW>
    77.         moApp.Visible = False
    78.         If (moApp.WindowState = wdWindowStateNormal) Or (moApp.WindowState = wdWindowStateMaximize) Then
    79.             moApp.WindowState = wdWindowStateMinimize
    80.         Else
    81.             moApp.WindowState = wdWindowStateMinimize
    82.         End If
    83.         '</HIDE MAIN WORD WINDOW>
    84.         '<PREP CHECK SPELLING OPTIONS DIALOG BOX (MODIFY TO YOUR PREFERENCES)>
    85.         moApp.Dialogs(wdDialogToolsSpellingAndGrammar).Application.Options.CheckGrammarWithSpelling = True
    86.         moApp.Dialogs(wdDialogToolsSpellingAndGrammar).Application.Options.SuggestSpellingCorrections = True
    87.         moApp.Dialogs(wdDialogToolsSpellingAndGrammar).Application.Options.IgnoreUppercase = True
    88.         moApp.Dialogs(wdDialogToolsSpellingAndGrammar).Application.Options.IgnoreInternetAndFileAddresses = True
    89.         moApp.Dialogs(wdDialogToolsSpellingAndGrammar).Application.Options.IgnoreMixedDigits = False
    90.         moApp.Dialogs(wdDialogToolsSpellingAndGrammar).Application.Options.ShowReadabilityStatistics = False
    91.         '</PREP CHECK SPELLING OPTIONS DIALOG BOX (MODIFY TO YOUR PREFERENCES)>
    92.         '<DO ACTUAL SPELL CHECKING>
    93.         moApp.Visible = True
    94.         moApp.Activate
    95.         lResp = moApp.Dialogs(wdDialogToolsSpellingAndGrammar).Display
    96.         '</DO ACTUAL SPELL CHECKING>
    97.         If lResp < 0 Then
    98.             moApp.Visible = True
    99.             MsgBox "Corrections Being Updated!", vbOKOnly + vbInformation, App.ProductName
    100.             Clipboard.Clear
    101.             oDoc.Select
    102.             oDoc.Range.Copy
    103.             sReplace = Clipboard.GetText(1)
    104.             '<FIX FOR POSSIBLE EXTRA LINE BREAK AT END OF TEXT>
    105.             If (InStrRev(sReplace, Chr(13) & Chr(10))) = (Len(sReplace) - 1) Then
    106.                 sReplace = Mid$(sReplace, 1, Len(sReplace) - 2)
    107.             End If
    108.             '</FIX FOR POSSIBLE EXTRA LINE BREAK AT END OF TEXT>
    109.             SpellMe = sReplace
    110.         ElseIf lResp = 0 Then
    111.             MsgBox "Spelling Corrections Have Been Canceled!", vbOKOnly + vbCritical, "VB/Office Guru™ SpellChecker"
    112.             SpellMe = msSpell
    113.         End If
    114.     Else
    115.         MsgBox "No Spelling Errors Found" & vbNewLine & "Or No Suggestions Available!", vbOKOnly + vbInformation, _
    116.         "VB/Office Guru™ SpellChecker"
    117.         SpellMe = msSpell
    118.     End If
    119.     '</CHECK SPELLING AND GRAMMER DIALOG BOX>
    120.     oDoc.Close False
    121.     Set oDoc = Nothing
    122.     '<HIDE WORD IF THERE ARE NO OTHER INSTANCES>
    123.     If KillMe = True Then
    124.         moApp.Visible = False
    125.     End If
    126.     '</HIDE WORD IF THERE ARE NO OTHER INSTANCES>
    127.     Screen.MousePointer = vbNormal
    128.     Exit Function
    129. No_Bugs:
    130.     If Err.Number = "91" Then
    131.         Resume Next
    132.     ElseIf Err.Number = "462" Then
    133.         MsgBox "Spell Checking Is Temporary Un-Available!" & vbNewLine & "Try Again After Program Re-Start.", _
    134.         vbOKOnly + vbInformation, "ActiveX Server Not Responding"
    135.         Screen.MousePointer = vbNormal
    136.     ElseIf Err.Number = 429 Then
    137.         Set moApp = Nothing
    138.         Resume Next
    139.     Else
    140.         MsgBox Err.Number & " " & Err.Description, vbOKOnly + vbInformation, App.ProductName
    141.         Screen.MousePointer = vbNormal
    142.     End If
    143. End Function
    144.  
    145. '*********************************************************
    146.  
    147. 'Example usage:
    148. 'Behind a form (Form1)
    149. '
    150. 'Add a single or multi-line textbox to your form
    151. 'Add a command button (Command1) to invoke the spell checking.
    152. Option Explicit
    153.  
    154. Private Sub Command1_Click()
    155.     '<SPELL CHECK>
    156.     Text1.Text = SpellMe(Text1.Text)
    157. End Sub
    158.  
    159. Private Sub Form_Load()
    160.     '<CALL THE SPELLME INITIALIZATION PROCEDURE BEFORE ANY USE>
    161.     InitializeMe
    162. End Sub
    163.  
    164. Private Sub Form_QueryUnload(Cancel As Integer, UnloadMode As Integer)
    165.     If KillMe = True Then
    166.         moApp.Quit False
    167.     End If
    168.     Set moApp = Nothing
    169. End Sub
    Attached Images Attached Images      
    Last edited by RobDog888; Jul 21st, 2005 at 01:19 PM. Reason: Spelling error :lol:; Another spelling error :(, Line Break fix; Hide Word Fix
    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, Corsair H100i v2 water cooler, Geforce GTX1060, Samsung M.2 500 GB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2010, VS 2010

  2. #2
    No place like 127.0.0.1 eyeRmonkey's Avatar
    Join Date
    Jul 2005
    Location
    Blissful Oblivion
    Posts
    2,306

    Re: Advanced VB/Office Guru™ SpellChecker™

    Thanks for the code RD!

    I seem to be having a problem with Word not closing when the spell check is done. the document is closing but word stays open with a blank MDI type window.

    Also, is there a way to make word not show in the taskbar when this is all happening? Its not a big deal, but if there is a simple solution, that would be nice.

    Thanks.
    Visual Studio 2005 Professional Edition (.NET Framework 2.0)
    ~ VB .NET Links: Visual Basic 6 to .NET Function Equivalents (Thread) | Refactor! (White Paper) | Easy Control for Wizard Forms | Making A Proper UI For WinForms | Graphics & GDI+ Tutorial | Websites For Free Icons
    ~ QUOTE: Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning. -Rich Cook

    ~ eyeRmonkey.com

  3. #3

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

    Re: Advanced VB/Office Guru™ SpellChecker™

    Can you post your code so I can see how its being implemented? Not the module code but your form code.

    I can probably come up with a way to hide word in the taskbar. Give me some time to test an idea.

    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, Corsair H100i v2 water cooler, Geforce GTX1060, Samsung M.2 500 GB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2010, VS 2010

  4. #4
    No place like 127.0.0.1 eyeRmonkey's Avatar
    Join Date
    Jul 2005
    Location
    Blissful Oblivion
    Posts
    2,306

    Re: Advanced VB/Office Guru™ SpellChecker™

    I really can't narrow it down to a certain part of the code so I am posting it all in an attachment.
    Attached Files Attached Files
    Visual Studio 2005 Professional Edition (.NET Framework 2.0)
    ~ VB .NET Links: Visual Basic 6 to .NET Function Equivalents (Thread) | Refactor! (White Paper) | Easy Control for Wizard Forms | Making A Proper UI For WinForms | Graphics & GDI+ Tutorial | Websites For Free Icons
    ~ QUOTE: Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning. -Rich Cook

    ~ eyeRmonkey.com

  5. #5

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

    Re: Advanced VB/Office Guru™ SpellChecker™

    EM, I updated my example with the fix for a possible extra line break that may or may not be added to the end of the replacement text.

    I will look at your code later today. I am leaving for an appointment.
    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, Corsair H100i v2 water cooler, Geforce GTX1060, Samsung M.2 500 GB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2010, VS 2010

  6. #6

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

    Re: Advanced VB/Office Guru™ SpellChecker™

    Ok, I made a few updates to the code in my original post. It will now hide the blank Word app between spell check runs if no other
    instance of Word is running. If there are then .Close'ing the document will remove it from the taskbar automatically.

    There is no easy way to remove Word from the taskbar when it is checking spelling though.
    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, Corsair H100i v2 water cooler, Geforce GTX1060, Samsung M.2 500 GB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2010, VS 2010

  7. #7
    Banned dglienna's Avatar
    Join Date
    Jun 2004
    Location
    Center of it all
    Posts
    17,901

    Re: Advanced VB/Office Guru™ SpellChecker™

    Hmmm. It corrected ttest, but it left S instead of A. Then it capitalized the first word in the sentence.

    Before

    this is a test, this is only s ttest
    After

    This is a test, this is only s test
    I didn't think Word did that. I'll have t try it.

    EDIT: Word does the same thing. Odd.

    Great Job. I like Grammar Check!
    Last edited by dglienna; Jul 21st, 2005 at 01:44 PM.

  8. #8

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

    Re: Advanced VB/Office Guru™ SpellChecker™

    How weird! I tested it and it doesnt pickup the s. I tested it also in Word and same results. Hmm...
    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, Corsair H100i v2 water cooler, Geforce GTX1060, Samsung M.2 500 GB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2010, VS 2010

  9. #9

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

    Re: Advanced VB/Office Guru™ SpellChecker™

    This also doesnt get detected in MS Word.
    test s is not a workin.
    Test s is not a working.
    I think Bill needs some Grammer lessions.
    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, Corsair H100i v2 water cooler, Geforce GTX1060, Samsung M.2 500 GB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2010, VS 2010

  10. #10
    Banned dglienna's Avatar
    Join Date
    Jun 2004
    Location
    Center of it all
    Posts
    17,901

    Re: Advanced VB/Office Guru™ SpellChecker™

    LOL. That was an actual typo, but after proof-reading it to make sure the misspelled word ttest was in there, I decided to leave it. Go Figure!

    Have to spread it around some. Got you for a 'Net thread the other day for the Line Numbers. I wondered how you would find line 697, but wasn't about to count them!

    Thanks.

  11. #11

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

    Re: Advanced VB/Office Guru™ SpellChecker™

    I was doing a spell check on my verbiage on the original post and I came up with some spelling errors!

    Just in case anyone is wondering about what is the ShowReadabilityStatistics then this is what it looks like after the checking is complete.


    Ps, Thanks Dave, I'm glad its starting to get some good feedback.

    Gangsta Yoda
    Attached Images Attached Images  
    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, Corsair H100i v2 water cooler, Geforce GTX1060, Samsung M.2 500 GB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2010, VS 2010

  12. #12

  13. #13

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

    Re: Advanced VB/Office Guru™ SpellChecker™

    I think most of it can be writtne in VB Script but I dont really know it well enough (probably a n00b at it ) to be able
    to give you a reliable answer. Isnt VB Script more like this code would be as if it was written using Late Binding?
    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, Corsair H100i v2 water cooler, Geforce GTX1060, Samsung M.2 500 GB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2010, VS 2010

  14. #14
    Former Admin/Moderator MartinLiss's Avatar
    Join Date
    Sep 1999
    Location
    San Jose, CA
    Posts
    33,072

    Re: Advanced VB/Office Guru™ SpellChecker™

    Here is the script file I use.

    VB Code:
    1. <!--
    2. +---------------------------------------------------------------------------+
    3.  
    4.     Function:    Spell Checker
    5.     Description: This script uses Microsoft Word to check the spelling in
    6.                  posts. Word is assumed to be present.
    7.  
    8. +---------------------------------------------------------------------------+
    9. -->
    10.  
    11. <SCRIPT LANGUAGE = "VBScript">  
    12.    
    13. Dim objWord
    14. Dim objDoc
    15. Dim objWindow
    16. Dim objSource
    17. Dim objSelect
    18. Dim objSelectRange
    19. Dim strResult
    20.  
    21. Set objWindow = window.external.menuArguments
    22. Set objSource = objWindow.event.srcElement
    23. Set oDocument = objWindow.document
    24. Set objSelect = oDocument.selection
    25. Set objSelectRange = objSelect.createRange()
    26. 'Create a new instance of word Application
    27. Set objWord = CreateObject("word.Application")
    28. 'new
    29. 'Dim dlg
    30. 'Set dlg = objWord.Dialogs
    31.  
    32. If objSource.tagName = "TEXTAREA" Then
    33.     select case objWord.version
    34.         'Office 2000
    35.         case "9.0"
    36.             with objWord
    37.                 .WindowState = 2
    38.                 .Visible = True
    39.             end with
    40.             Set objDoc= objWord.Documents.Add( , ,1, True)
    41.         'Office XP
    42.         case "10.0"
    43.             with objWord
    44.                 .windowstate = 2
    45.                 .Visible = False
    46.             end with
    47.             Set objDoc= objWord.Documents.Add( , ,1, True)
    48.             with objWord
    49.                 .windowstate =2
    50.                 .Visible = True
    51.             end with
    52.         'Office 97
    53.         case else ' Office 97
    54.             Set objDoc= objWord.Documents.Add
    55.     end select
    56.  
    57.  
    58.         objDoc.Content=objSelectRange.text
    59.         objDoc.CheckSpelling
    60. 'dlg(828).Show(0)
    61.     strResult = left(objDoc.Content, len(objDoc.Content) - 1)
    62.  
    63.     ' This part may not work if you don't use IE
    64.     If objSelectRange.text = strResult Then
    65.         ' There were no spelling errors, so give the user a
    66.         ' visual signal that something happened
    67.         window.alert("The spelling check is complete.")
    68.     End If
    69.  
    70.         ' Replace the selected text with the corrected text
    71.     objSelectRange.text = strResult
    72.  
    73.         'Clean up
    74.         objDoc.Close False
    75.         Set objDoc= Nothing
    76.         objWord.Application.Quit True
    77.         Set objWord= Nothing
    78. end if
    79.  
    80. </SCRIPT>

  15. #15

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

    Re: Advanced VB/Office Guru™ SpellChecker™

    Is this an addition to that VBF Add-In one of our members made? If not how are you executing it?

    Does the Set dlg = objWord.Dialogs work?

    The const value for the spellingandgrammER dialog is = 828
    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, Corsair H100i v2 water cooler, Geforce GTX1060, Samsung M.2 500 GB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2010, VS 2010

  16. #16
    Former Admin/Moderator MartinLiss's Avatar
    Join Date
    Sep 1999
    Location
    San Jose, CA
    Posts
    33,072

    Re: Advanced VB/Office Guru™ SpellChecker™

    Quote Originally Posted by RobDog888
    Is this an addition to that VBF Add-In one of our members made? If not how are you executing it?

    Does the Set dlg = objWord.Dialogs work?

    The const value for the spellingandgrammER dialog is = 828
    Yes it all works and yes, it is a part of the "Forum Tool" that I mention in my signature. The code is in an htm file that via Registry entries is appended to the IE right-click context menu.

  17. #17

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

    Re: Advanced VB/Office Guru™ SpellChecker™

    Martin, instead of checking for a string match between the doc and the string variable you may be able to use words error count
    instead and that may help bring the function to other browsers then IE.

    VB Code:
    1. oDoc.SpellingErrors.Count ;)
    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, Corsair H100i v2 water cooler, Geforce GTX1060, Samsung M.2 500 GB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2010, VS 2010

  18. #18

  19. #19
    New Member
    Join Date
    Sep 2005
    Posts
    1

    Re: Advanced VB/Office Guru™ SpellChecker™

    I am having one problem. I'm finding that if I happen to have another instance of Word open for another reason it will close it without asking and I will lose my original document. is there any code fix that you can think of that will leave my original word document alone?

    -Gary

  20. #20

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

    Re: Advanced VB/Office Guru™ SpellChecker™

    I have been thinking about this for a while and I had tested the code quite well too so I'm not sure yet. How are you implementing it? All in one form or in a module like I have? What version of Word are you 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, Corsair H100i v2 water cooler, Geforce GTX1060, Samsung M.2 500 GB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2010, VS 2010

  21. #21

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

    Re: Advanced VB/Office Guru™ SpellChecker™

    I am running 2003 and I havent been able to replicate Word closing down when a previous document already exists. Can you give more details on how your implementing it?
    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, Corsair H100i v2 water cooler, Geforce GTX1060, Samsung M.2 500 GB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2010, VS 2010

  22. #22

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

    Re: Advanced VB/Office Guru™ SpellChecker™

    I even tried it with multiple separate instances of Word and still didnt close any word windows upon the spellchecker close.
    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, Corsair H100i v2 water cooler, Geforce GTX1060, Samsung M.2 500 GB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2010, VS 2010

  23. #23
    Hyperactive Member
    Join Date
    Sep 2004
    Posts
    262

    Re: [RESOLVED] Spell Checker

    Hi, in an Access Module I've copied and pasted the code above. Then in an access form I try the following.

    VB Code:
    1. Private Sub Command0_Click()
    2. Me.Text1 = SpellMe(Me.Text1)
    3.  
    4. End Sub
    5.  
    6. Private Sub Command3_Click()
    7.     InitializeMe
    8. End Sub
    9.  
    10.  
    11.  
    12. Private Sub Form_QueryUnload(Cancel As Integer, UnloadMode As Integer)
    13.     If KillMe = True Then
    14.         moApp.Quit False
    15.     End If
    16.     Set moApp = Nothing
    17. End Sub

    The module gets called okay but errors out on the
    App.OleRequestPendingTimeout = 999999
    if I tab this out it then errors out on
    Clipboard.Clear

    Where does App and clipboard come from eg what refereces do I need, or is this never going to work in Access VBA?
    Anyway thanks in advance for any help

  24. #24

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

    Re: Advanced VB/Office Guru™ SpellChecker™

    I moved your post to my CodeBank thread for the VB 6 version of my spellchecker.

    In Access there is no QueryUnload event so you need to use the Unload event

    VB Code:
    1. Private Sub Form_Unload(Cancel As Integer)
    2.  
    3. End 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, Corsair H100i v2 water cooler, Geforce GTX1060, Samsung M.2 500 GB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2010, VS 2010

  25. #25

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

    Re: Advanced VB/Office Guru™ SpellChecker™

    If your using Access only then you dont need any of the code other then using Access' built in spell checking.
    VB Code:
    1. Private Sub SpellMe()
    2.     Application.DoCmd.RunCommand acCmdSpelling
    3. End 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, Corsair H100i v2 water cooler, Geforce GTX1060, Samsung M.2 500 GB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2010, VS 2010

  26. #26
    Hyperactive Member
    Join Date
    Sep 2004
    Posts
    262

    Re: Advanced VB/Office Guru™ SpellChecker™

    Sorry, getting confused in my old age, anyway the problem with that is it automatically checks the whole form which I don't want, as the form in question is huge.
    Currently I spell check like so.

    VB Code:
    1. Public Function Spellcheck(TextStr As String) As String
    2.  
    3.      Set WordApp = CreateObject("Word.Application")
    4.      WordApp.Documents.Add
    5.      Dim wordrange As Word.Range
    6.      Set wordrange = WordApp.ActiveDocument.Range(0, 0)
    7.      wordrange.Text = TextStr
    8.      WordApp.Visible = True
    9.      WordApp.Activate
    10.      wordrange.CheckSpelling , , True
    11.      wordrange.CheckGrammar
    12.      Spellcheck = wordrange.Text
    13.      wordrange.Text = ""
    14.      WordApp.Documents.Close (False)
    15.      WordApp.Quit
    16.      Set WordApp = Nothing
    17. End Function

    But this has odd glitches which I was hoping your code would sort out.

  27. #27

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

    Re: Advanced VB/Office Guru™ SpellChecker™

    So your not using VB 6 at all and you dont want to use the built in spell checker? If you just select the textbox or text and the call the SpellMe procedure I just posted it will only check the selection or textbox only.
    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, Corsair H100i v2 water cooler, Geforce GTX1060, Samsung M.2 500 GB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2010, VS 2010

  28. #28
    Hyperactive Member
    Join Date
    Sep 2004
    Posts
    262

    Re: Advanced VB/Office Guru™ SpellChecker™

    Sorry feel am being relly stupid here. I don't mean to be a pain.
    Yes this is fully in access so not vb6 at all.
    Anyway have tried using
    Application.DoCmd.RunCommand acCmdSpelling
    It checks the spelling but then shoots off and spell checks other text boxes.
    Which as this database form is used by some very uncomputer literate people I think this will confuse them no end.

  29. #29

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

    Re: Advanced VB/Office Guru™ SpellChecker™

    Did you make a selection first?
    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, Corsair H100i v2 water cooler, Geforce GTX1060, Samsung M.2 500 GB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2010, VS 2010

  30. #30
    Hyperactive Member
    Join Date
    Sep 2004
    Posts
    262

    Re: Advanced VB/Office Guru™ SpellChecker™

    Not sure what you mean tried higlighting the text and then doing it, but after it checked the highlighted text it moved on to another control.

  31. #31

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

    Re: Advanced VB/Office Guru™ SpellChecker™

    It works in my test form with several textboxes. I highlight 1 and then spellcheck it and it doesnt check the rest of the textboxes.
    VB Code:
    1. Option Compare Database
    2.  
    3. Private Sub SpellMe()
    4.     Me.Text0.SelStart = 0
    5.     Me.Text0.SelLength = Len(Me.Text0.Text)
    6.     Application.DoCmd.RunCommand acCmdSpelling
    7. End Sub
    8.  
    9. Private Sub Form_Click()
    10.     SpellMe
    11. End 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, Corsair H100i v2 water cooler, Geforce GTX1060, Samsung M.2 500 GB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2010, VS 2010

  32. #32
    Hyperactive Member
    Join Date
    Sep 2004
    Posts
    262

    Re: Advanced VB/Office Guru™ SpellChecker™

    Thanks that works, assume Access doesn't have a grammer checker though.

  33. #33

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

    Re: Advanced VB/Office Guru™ SpellChecker™

    AFAIK, Access does not have a Grammer checker.
    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, Corsair H100i v2 water cooler, Geforce GTX1060, Samsung M.2 500 GB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2010, VS 2010

  34. #34
    Hyperactive Member
    Join Date
    Sep 2004
    Posts
    262

    Re: Advanced VB/Office Guru™ SpellChecker™

    Thanks for you help.

  35. #35

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

    Re: Advanced VB/Office Guru™ SpellChecker™

    Anytime

    If you wanted the Grammer checker then you would need to have Word installed and use my original code - post #1.
    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, Corsair H100i v2 water cooler, Geforce GTX1060, Samsung M.2 500 GB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2010, VS 2010

  36. #36
    New Member
    Join Date
    Jan 2006
    Posts
    7

    Re: Advanced VB/Office Guru™ SpellChecker™

    Hi 'Oliver1',
    I was just having a read through this thread and was wondering would you mind possibly giving me a sample of where/how you set the acCmdSpelling checks in VBA? ,when you were initially checking all the text boxes on the form?

    Would be appreciated if possible,

    Thanks

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

    Re: Advanced VB/Office Guru™ SpellChecker™

    I have just implemented this code in my app yesterday and have the following (small) problems. Firstly, when the user clicks to Spellcheck, the dialog box doesn't always come to the top and it makes the app seem as if it is stuck. Secondly, if they have any other Office app running, this app comes to the forefront immediately the button is pressed. My users are running Office 2003 if this is any help.
    Thanks

  38. #38
    Frenzied Member
    Join Date
    Apr 2005
    Posts
    1,907

    Re: Advanced VB/Office Guru™ SpellChecker™

    Quote Originally Posted by eyeRmonkey
    I really can't narrow it down to a certain part of the code so I am posting it all in an attachment.

    man i get this error:


    Code:
    Compile error:
    
    User-defined type not defined
    and pointing at :

    WithEvents objSysTray As vbSysTrayTools.SysTray


    could u tell me how to fix it i am using visual basic 6.thanks

  39. #39

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

    Re: Advanced VB/Office Guru™ SpellChecker™

    Thats not in my code example but it loks like your missing a class or control in your project.
    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, Corsair H100i v2 water cooler, Geforce GTX1060, Samsung M.2 500 GB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2010, VS 2010

  40. #40
    Frenzied Member
    Join Date
    Apr 2005
    Posts
    1,907

    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.
    Thanks for u reply. Oh i was thinking it was u code but now i tried your code and i get the following error:

    Compile error:

    User-defined type not defined

    and pointing at :

    Public moApp As Word.Application


    could u help me fix this error. I added one button and a textbox to the project. What else do i need such as refrences or any other controles?

    Furthermore, is it possible to underline the spelling mistakes as we type and by clicking on mistake it gives suggestions? Also is it possible to make this program so it only does what i just described on external editboxes ? I be happy if u help me here.Thanks
    Last edited by tony007; Jul 31st, 2006 at 04:33 AM.

Page 1 of 3 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
  •  



Featured


Click Here to Expand Forum to Full Width