全局代码——————————————————————————————————
Public Sub WebBrowser1_DocumentCompleted(ByVal sender As System.Object, ByVal e As System.Windows.Forms.WebBrowserDocumentCompletedEventArgs)
axWebBrowser = sender.ActiveXInstance
End Sub
axWebBrowser = Nothing
——————————————————————————————————————
在窗口中选择word按钮执行的代码———————————————————————
Dim dlg As New OpenFileDialog '定义一个新的OpenFileDialog
dlg.Filter = "word文件|*.docx"
If dlg.ShowDialog = DialogResult.OK Then '如果用户单击了确定按钮
Dim web As Object = e.Form.Controls("WebBrowser1").basecontrol
web.Navigate(dlg.FileName)
Do Until axWebBrowser IsNot Nothing
Application.DoEvents
Loop
Dim oDocument As object = axWebBrowser.Gettype().InvokeMember("Document",
System.Reflection.BindingFlags.GetProperty,
Nothing, axWebBrowser,
Nothing)
Dim oApplication As object = axWebBrowser.Gettype().InvokeMember("Application",
System.Reflection.BindingFlags.GetProperty,
Nothing, oDocument,
Nothing)
oDocument.saved = True
vars("doc")
= oDocument
End If
——————————————————————————————————————
意图通过webbrowser显示word,更换word文件内容,但不想让word工具栏闪烁,能否做到?