Results 1 to 5 of 5

Thread: Vb6 - Spell Check Function

  1. #1
    Interweb adm/o/distrator Paul M's Avatar
    Join Date
    Nov 06
    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 05
    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.
    My Flickr Stream »


    My Sites » BlogTwitterFlickr

  3. #3
    PowerPoster
    Join Date
    Feb 02
    Location
    Canada, Toronto
    Posts
    5,691

    Re: Vb6 - Spell Check Function

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

  4. #4
    Super Moderator RobDog888's Avatar
    Join Date
    Apr 01
    Location
    LA, Calif. Raiders #1 AKA:Gangsta Yoda™
    Posts
    59,465

    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 (VBA, VB 6, VB.NET, C#)
    Software Engineer MCP (VB 6 & .NET), BSEE, CET
    If a post has helped you then Please Rate it!
    Star Wars Gangsta Rap Reps & Rating PostsVS.NET on Vista (New)Multiple .NET Framework Versions (New)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 Core 2 Extreme Ed., 2 WD Raptor 10K RPM 150 GB HDs RAID 1, 2 GBs DDR2 667 MHz RAM, 3 Viewsonic 17" LCDs, Windows Vista RTM, IE 7, Office 2007

  5. #5
    Interweb adm/o/distrator Paul M's Avatar
    Join Date
    Nov 06
    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
  •