none
Excel a WebBrowser Visual Studio RRS feed

  • Pregunta

  • Hola,

    Gracias por este foro para compartir las inquietudes de Visual Studio. Tengo una  pregunta realcionada con WebBrowser

    quiero hacer que excel sea vista a traves de webBrowser pero no consigo dar con el codigo correcto, ma podiais echar una mano.

    Gracias.

    Public Class Form1
    
        Dim oDocument As Object
    
        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 Form1_Load(ByVal sender As Object, ByVal e As  _
           System.EventArgs) Handles MyBase.Load
    
            Button1.Text = "Browse"
    
            With OpenFileDialog1
                .Filter = "Office Documents " & _
                "(*.doc, *.xlsx, *.xls, *.ppt)|*.doc;*.xlsx;*.xls,*.ppt"
                .FilterIndex = 1
            End With
    
        End Sub
    
        Private Sub Form1_Closing(ByVal sender As Object, ByVal e As  _
           System.ComponentModel.CancelEventArgs) Handles MyBase.Closing
    
            oDocument = Nothing
    
        End Sub
    
        Private Sub AxWebBrowser1_NavigateComplete2(ByVal sender As Object, _
           ByVal e As AxSHDocVw.DWebBrowserEvents2_NavigateComplete2Event)
    
    
            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

    Me da error cuando carga la pagina.

    What you can try: 
         Retype the address. 
     
    

    lunes, 26 de mayo de 2014 7:24

Respuestas