0

Solved by Comment from Joe Albahari

In LinQPad 7 I try to connect to an open Excel Application. In C# .net this is easy done by eg:

public Microsoft.Office.Interop.Excel.Application ExcelApplication; ExcelApplication = (Application)Microsoft.VisualBasic.Interaction.GetObject(Class: "Excel.Application");

With references to Microsoft.Office.Interop.Excel and Microsoft.VisualBasic

In LinQPad 7 I tried the same but ExcelApplication is null (Yes Excel is open!) References are set and Namespace imported. It shows no error, just does not connect.

What am I doing wrong? (The example from LinqPad for Excel creates a new excel application.

thanks for any help

Red Hare
  • 402
  • 1
  • 11
  • 1
    Does the following help: https://stackoverflow.com/a/65496277 – Joe Albahari Dec 12 '22 at 04:57
  • Thanks so much. I tried the Marshall approach but failed at GetActiveObject like in the article. But I could not find the solution in SO which is given in this Article by the Marshal2 Class. Works like a charm. Tx again. – Red Hare Dec 12 '22 at 09:12

0 Answers0