Private Sub Form1_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load Button1.Text = "Browse" With OpenFileDialog1 .Filter = "Office Documents " & _ "(*.doc, *.xls, *.xlsx,*.ppt)|*.doc;*.xls;*.xlsx;*.ppt" .FilterIndex = 1 End With End Sub -------------------------- Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click Dim strFileName As String 'Find the Office document. With OpenFileDialog1 .FileName = "" .ShowDialog() strFileName = .FileName End With 'If the user does not cancel, open the document. If strFileName.Length Then oDocument = Nothing AxWebBrowser1.Navigate(strFileName) End If End Sub -------------------------------- Private Sub ReadOnlyWordFile_FormClosing(ByVal sender As System.Object, ByVal e As System.Windows.Forms.FormClosingEventArgs) Handles MyBase.FormClosing oDocument = Nothing End Sub -------------------------------- Private Sub AxWebBrowser1_NavigateComplete2(ByVal sender As System.Object, ByVal e As AxSHDocVw.DWebBrowserEvents2_NavigateComplete2Event) Handles AxWebBrowser1.NavigateComplete2 On Error Resume Next oDocument = e.pDisp.Document 'Note: You can use the reference to the document object to ' automate the document server. MsgBox("File opened by: " & oDocument.Application.Name) End Sub
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)