AutoCAD 3DMAX C语言 Pro/E UG JAVA编程 PHP编程 Maya动画 Matlab应用 Android
Photoshop Word Excel flash VB编程 VC编程 Coreldraw SolidWorks A Designer Unity3D
 首页 > VB编程

VB 中调用 Word 拼写检查

51自学网 http://www.wanshiok.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  下一篇:在Word中嵌入应用程序