Home » excel » list excel workbook connections in C#

list excel workbook connections in C#

Posted by: admin April 23, 2020 Leave a comment


I would like to list the connections of an excel file, in C#.
Using COM interface, I can open the excel file, but how can I find references?
enter image description here

How to&Answers:

I’m not sure how to do it in C# but this may put you on the right path.
In Excel VBA you can cycle through the .Connections property inside of the workbook object.

here’s an example that prints all the connections to the debug window:

Dim conn As WorkbookConnection
For Each conn In ActiveWorkbook.Connections
    Debug.Print conn.Name
Next conn