龙盟编程博客 | 无障碍搜索 | 云盘搜索神器
快速搜索
主页 > 软件开发 > VB开发 >

VB中调用Word拼写检查

时间:2009-12-30 15:42来源:未知 作者:admin 点击:
分享到:
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->

精彩图集

赞助商链接