Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Click
Dim Word_APP As Microsoft.Office.Interop.Word.Application
On Error Resume Next
Word_APP = GetObject(, "Word.Application")
If Err.Number Then
Err.Clear()
Word_APP = CreateObject("Word.Application")
If Err.Number Then
MsgBox("不能运行Microsoft.Word,请检查是否安装了Microsoft.Word")
Exit Sub
End If
End If
Word_APP.Visible = True '界面可视
Word_APP.WindowState = Microsoft.Office.Interop.Word.WdWindowState.wdWindowStateNormal
AppActivate(Word_APP.Caption) '显示Word界面
Word_APP.Options.CheckGrammarAsYouType = False '不拼写检查
Word_APP.ActiveWindow.Selection.Fields.Add(Range:=Word_APP.ActiveWindow.Selection.Range, Type:=Microsoft.Office.Interop.Word.WdFieldType.wdFieldEmpty, PreserveFormatting:=False)
Word_APP.ActiveWindow.Selection.TypeText(Text:="EQ 2\F(2,3) ")
Word_APP.ActiveWindow.Selection.Fields.ToggleShowCodes()
End Sub
Dim Word_APP As Microsoft.Office.Interop.Word.Application
On Error Resume Next
Word_APP = GetObject(, "Word.Application")
If Err.Number Then
Err.Clear()
Word_APP = CreateObject("Word.Application")
If Err.Number Then
MsgBox("不能运行Microsoft.Word,请检查是否安装了Microsoft.Word")
Exit Sub
End If
End If
Word_APP.Visible = True '界面可视
Word_APP.WindowState = Microsoft.Office.Interop.Word.WdWindowState.wdWindowStateNormal
AppActivate(Word_APP.Caption) '显示Word界面
Word_APP.Options.CheckGrammarAsYouType = False '不拼写检查
Word_APP.ActiveWindow.Selection.Fields.Add(Range:=Word_APP.ActiveWindow.Selection.Range, Type:=Microsoft.Office.Interop.Word.WdFieldType.wdFieldEmpty, PreserveFormatting:=False)
Word_APP.ActiveWindow.Selection.TypeText(Text:="EQ 2\F(2,3) ")
Word_APP.ActiveWindow.Selection.Fields.ToggleShowCodes()
End Sub
http://office.microsoft.com/zh-cn/word-help/HP005186148.aspx
[本日志由 tiancao1001 于 2012-01-03 01:32 PM 编辑]
|
暂时没有评论
发表评论 - 不要忘了输入验证码哦! |