VBcoders Guest



Don't have an account yet? Register
 


Forgot Password?



Check spelling!

by Kailash Nadh (9 Submissions)
Category: Files/File Controls/Input/Output
Compatability: Visual Basic 3.0
Difficulty: Unknown Difficulty
Originally Published: Wed 10th July 2002
Date Added: Mon 8th February 2021
Rating: (1 Votes)

Check spelling!

Rate Check spelling!



'Uses Microsoft Word Spelling Dictionary to check a spelling!

'Test this by using wrong spelling for Word as Worud
'Usage: Call chkit("Test Worud")

Function Chkit(strWord As String) As String
    Dim msWord As Object
    Dim strSelection As String
    Set msWord = CreateObject("Word.Basic")
    msWord.AppMinimize
    Chkit = strWord
    msWord.FileNewDefault
    msWord.EditSelectAll
    msWord.EditCut
    msWord.Insert strWord
    msWord.StartOfDocument
    On Error Resume Next
    msWord.ToolsSpelling
    On Error GoTo 0
    msWord.EditSelectAll
    strSelection = msWord.Selection$
     
If Mid(strSelection, Len(strSelection), 1) = Chr(13) Then
  strSelection = Mid(strSelection, 1, Len(strSelection) - 1)
End If

If Len(strSelection) > 1 Then
  Chkit = strSelection
End If

    msWord.FileCloseAll 2
    msWord.AppClose
    Set msWord = Nothing
End Function

Download this snippet    Add to My Saved Code

Check spelling! Comments

No comments have been posted about Check spelling!. Why not be the first to post a comment about Check spelling!.

Post your comment

Subject:
Message:
0/1000 characters