VB 中调用 Word 拼写检查
添加时间: 2006-2-17 3:14:48 作者: VB教程 阅读次数:141 来源: http://www.d9soft.com
Function CheckSpell(IncorrectText as string) as string
Dim Word As Object, retText$
On Error Resume Next
注释: 建立对象并打开 WORD
Set Word = CreateObject("Word.Basic")
注释: 把需要检查的 STRING 放到 WORD
Word.AppShow
Word.FileNew
Word.Insert IncorrectText
注释: 运行 WORD 拼写检查
Word.ToolsSpelling
Word.EditSelectAll
注释: 取返回值
retText = Word.Selection$()
CheckSpell = Left$(retText, Len(retText) - 1)
注释:关闭文件并回到 VB 应用
Word.FileClose 2
Show
Set Word = Nothing
End Function
上下文章:
上一篇文章: 怎样在VB中控制Word? 下一篇文章: 用VB6.0设计简易赛车游戏
相关文章:

