VB 中调用 Word 拼写检查 作者: 评价: 上站日期: 2001-09-06 内容说明: 来源: Function CheckSpell(IncorrectText as string) as stringDim Word As Object, retText$ On Error Resume Next ' 建立对象并打开 WORDSet 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

评论