Click here to Skip to main content
15,902,899 members
Please Sign up or sign in to vote.
4.00/5 (1 vote)
See more:
I download the code to do shown the doc file into Microsoft Web Browser control to the Form.
The following code is below:---

VB
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

But above code is not properly shown the doc file into the form.
It is open to another window of doc file.

Why????

please please help me anybody.....
Posted
Updated 24-Aug-12 4:23am
v2
Comments
Member 7678194 24-Aug-12 6:09am    
Till not woking....
Why???

1 solution

Hi,

You can have a look at the below link;

http://support.microsoft.com/kb/304662[^]

Hope this helps :)

Jas
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900