Results 1 to 5 of 5

Thread: Vb6 - Spell Check Function

  1. #1

    Thread Starter
    Interweb adm/o/distrator Paul M's Avatar
    Join Date
    Nov 2006
    Location
    Australia, Melbourne
    Posts
    2,306

    Vb6 - Spell Check Function

    VB Code:
    1. Public Sub SpellCheck(ByRef TextObj As RichTextBox)
    2. Dim objSpellCheck    As Object
    3. Dim tmpClipBoardText As String
    4.     If TextObj.Text = vbNullString Then Exit Sub
    5.     Screen.MousePointer = 13
    6.     tmpClipBoardText = Clipboard.GetText
    7.     Set objSpellCheck = CreateObject("Word.Application")
    8.     objSpellCheck.Visible = False
    9.     objSpellCheck.Documents.Add
    10.     Clipboard.Clear
    11.     Clipboard.SetText TextObj.Text
    12.     With objSpellCheck
    13.         .Selection.Paste
    14.         .ActiveDocument.CheckSpelling
    15.         .Visible = False
    16.         .ActiveDocument.Select
    17.         .Selection.Cut
    18.     End With
    19.     TextObj.Text = Clipboard.GetText
    20.     objSpellCheck.ActiveDocument.Close SaveChanges:=0
    21.     objSpellCheck.Quit
    22.     Set objSpellCheck = Nothing
    23.     Clipboard.SetText tmpClipBoardText
    24.     Screen.MousePointer = 0
    25. Exit Sub
    26. End Sub


    When using this function for a textbox ---------->
    VB Code:
    1. Public Sub SpellCheck(ByRef TextObj As TextBox)

  2. #2
    Frenzied Member I_Love_My_Vans's Avatar
    Join Date
    Jan 2005
    Location
    In the PHP compiler
    Posts
    1,275

    Re: Vb6 - Spell Check Function

    Works ok, might want to put the cursor back to where it was before.

  3. #3
    PowerPoster
    Join Date
    Feb 2002
    Location
    Canada, Toronto
    Posts
    5,803

    Re: Vb6 - Spell Check Function

    I don't understand why does it have to mess with the Clipboard ?

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

    Re: Vb6 - Spell Check Function

    Because, like in my SpellChecker™, by using the clipboard you retain the compatibility of the new lines.
    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. #5

    Thread Starter
    Interweb adm/o/distrator Paul M's Avatar
    Join Date
    Nov 2006
    Location
    Australia, Melbourne
    Posts
    2,306

    Re: Vb6 - Spell Check Function

    So it worked allright for those of you who used it?

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