本文介绍了在文本框中进行拼写检查的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我必须使用文本框来对其中输入的单词进行拼写检查,请帮助
i have to use a textbox which will do spell check of the words entered inside it ,pls help
推荐答案
Dim objWord As Object
Dim objDoc As Object
Dim strResult As String
''Create a new instance of word Application
Set objWord = CreateObject("word.Application")
Select Case objWord.Version
''Office 2000
Case "9.0"
Set objDoc = objWord.Documents.Add(, , 1, True)
''Office XP
Case "10.0"
Set objDoc = objWord.Documents.Add(, , 1, True)
''Office 97
Case Else '' Office 97
Set objDoc = objWord.Documents.Add
End Select
objDoc.Content = Text1.Text
objDoc.CheckSpelling
strResult = Left(objDoc.Content, Len(objDoc.Content) - 1)
If Text1.Text = strResult Then
'' There were no spelling errors, so give the user a
'' visual signal that something happened
MsgBox "The spelling check is complete.", vbInformation + vbOKOnly
End If
''Clean up
objDoc.Close False
Set objDoc = Nothing
objWord.Application.Quit True
Set objWord = Nothing
'' Replace the selected text with the corrected text. It''s important that
'' this be done after the "Clean Up" because otherwise there are problems
'' with the screen not repainting
Text1.Text = strResult
Exit Sub
下午我,如果它不工作.
我会尝试回覆.
希望对您有帮助.
祝你好运. :)
-chaosgray-
pm me if its not working.
i''ll try to answer back.
hope it helps.
goodluck. :)
-chaosgray-
这篇关于在文本框中进行拼写检查的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!