确实如此,你必须装有office97以上
然后,声明一个Document对象,具体有些细节不便一一道明,有以下代码你消化消化
Dim mdocSpell As New Document
Private Sub cmdSpell_Click()
'Add text to a word range object
mdocSpell.Range.Text = txtSpell ‘txtSpell是一个textBox
'IMPORTANT:you must perform the following two steps
'before using the check spelling method!!
'be sure that word is visible
mdocSpell.Application.Visible = True
'activate word
AppActivate mdocSpell.Application.Caption
'check spelling
mdocSpell.Range.CheckSpelling
'update text box with changes from word
txtSpell = mdocSpell.Range.Text
'Trim off null character that word adds
txtSpell = Left(txtSpell, Len(txtSpell) - 1)
'activate this application
AppActivate Caption
End Sub
然后,声明一个Document对象,具体有些细节不便一一道明,有以下代码你消化消化
Dim mdocSpell As New Document
Private Sub cmdSpell_Click()
'Add text to a word range object
mdocSpell.Range.Text = txtSpell ‘txtSpell是一个textBox
'IMPORTANT:you must perform the following two steps
'before using the check spelling method!!
'be sure that word is visible
mdocSpell.Application.Visible = True
'activate word
AppActivate mdocSpell.Application.Caption
'check spelling
mdocSpell.Range.CheckSpelling
'update text box with changes from word
txtSpell = mdocSpell.Range.Text
'Trim off null character that word adds
txtSpell = Left(txtSpell, Len(txtSpell) - 1)
'activate this application
AppActivate Caption
End Sub
解决方案 »
- 求有关学生和老师的控件和源代码
- 在第一个combo中列出字段,如何关连第二个combo列出字段的值备选呢?
- 为什么写好的程序拿到别的机器上总是出现这个ocx未注册那个ocx版本不兼容的问题/提示,即便制作了安装包也是一样.有好的解决方案吗?
- 严重问题!为什么说VB是“弱类型语言”?
- 有谁用过vsPrinter打印控件吗??? 急!急!急!
- 求一刻录软件
- 请高手指点:为何所有ACCESS数据库表全部无法打开?
- 在VB里如何用JMAIL发送带有附件的邮件?
- 如何解决CommonDialog1.ShowPrinter的窗口选择“取消”的问题
- 从VB中能播放Powerpoint的幻灯片么?
- 、这个sql语句怎么写?
- 怎样让EDIT控件里内容显不同的颜色
其他的同my8848
然后
Private Sub cmdSpell_Click()
Dim X As Object 'create Word object variable
Set X = CreateObject("Word.Application")
X.Visible = True 'hide Word
X.Documents.Add 'open a new document
X.Selection.Text = Text1.Text 'copy text box to document
X.ActiveDocument.CheckSpelling 'run spell check
Text1.Text = X.Selection.Text 'copy results back
X.ActiveDocument.Close SaveChanges:=wdDoNotSaveChanges
X.Quit 'quit Word
Set X = Nothing 'release object variable
End Sub