首页 > 学院 > 开发设计 > 正文

VB中调用Word拼写检查

2019-11-18 17:49:42
字体:
来源:转载
供稿:网友
FunctionCheckSpell(IncorrectTextasstring)asstring
DimWordAsObject,retText$
OnErrorResumeNext
'建立对象并打开WORD
SetWord=CreateObject("Word.Basic")

'把需要检查的STRING放到WORD
Word.AppShow
Word.FileNew
Word.InsertIncorrectText

'运行WORD拼写检查
Word.ToolsSpelling
Word.EditSelectAll

'取返回值
retText=Word.Selection$()
CheckSpell=Left$(retText,Len(retText)-1)

'关闭文件并回到VB应用
Word.FileClose2
Show

SetWord=Nothing
EndFunction->


发表评论 共有条评论
用户名: 密码:
验证码: 匿名发表