This project has moved. For the latest updates, please go here.

Attach interop

Sep 14, 2011 at 2:50 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

Coordinator
Sep 14, 2011 at 2:56 PM

hey jannick,

thank you, of course you have a constructor for that

dim objExcel as new LateBindingApi.Excel.Application(Nothing, oApplication)

oApplication is now managed by NetOffice

regards*
Sebastian


Sep 14, 2011 at 3:17 PM

Hé SebastianDotNet,

I feel really stupid. I should read the existing discussion first before asking questions. (I just found GetRunningOutlookInstance)

 

But thanks for the quick reply

 

Regards,

Jannick

Coordinator
Sep 14, 2011 at 3:21 PM

haha no worries ;) btw: the COMAddin example is also a good way to see how to convert a native proxy
in a netoffice wrapper class.

*regards again
Sebastian