Attach interop

Sep 13, 2011 at 3:12 PM
Edited Sep 13, 2011 at 3:13 PM

Hi,

 

First of all: THANKS FOR THESE GREAT APIs!!

is there by any chance a way to convert Microsoft.Office.Interop.Excel.application(class) to latebindingapi.excel.application (or a constructor where i can give Microsoft.Office.Interop.Excel.application as input-parameter)

I would like to use the webbrowser-component (winform application)

 

   Private Sub WebBrowser1_Navigated(ByVal sender As Object, ByVal e As System.Windows.Forms.WebBrowserNavigatedEventArgs) Handles WebBrowser1.Navigated

      If e.Url.ToString = "about:blank" Then
         Exit Sub
      End If
      Dim o As Object = WebBrowser1.ActiveXInstance

      oWorkbook = o.GetType().InvokeMember("Document", BindingFlags.GetProperty, Nothing, o, Nothing)

      oApplication = o.GetType().InvokeMember("Application", BindingFlags.GetProperty, Nothing, oWorkbook, Nothing)

    'I would like one of these next two statements to work :-)
    dim objExcel as LateBindingApi.Excel.Application = ctype(oApplication,LateBindingApi.Excel.Application)

-- or --
   dim objExcel as new LateBindingApi.Excel.Application(oApplication)


   End Sub