- Sub Macro2()
- ActiveWorkbook.Queries.Add _
- Name:="TabWBS112288", _
- Formula:="let Source = Excel.CurrentWorkbook(){[Name=""TabWBS112288""]}[Content] in Source"
- Workbooks("WBS test.xlsx").Connections.Add2 _
- Name:="Query - TabWBS112288", _
- Description:="Connection to the 'TabWBS112288' query in the workbook.", _
- ConnectionString:="OLEDB;Provider=Microsoft.Mashup.OleDb.1;Data Source=$Workbook$;Location=TabWBS112288;Extended Properties=""""", _
- CommandText:="SELECT * FROM [TabWBS112288]", _
- lCmdtype:=2
- End Sub
With .NET I use the Excel interop but it seems not have the same query objects as VBA. The interop has workbookconnections and models but not queries.
I need to manipulate Excel queries using C# in Visula Studio but I do not know how to.
How can I code the example VBA in C#?
Kobus BurgerPosted Oct 13, 2020, 9:58 AM
alice yangPosted Oct 12, 2020, 8:15 PM
Sachin SinghPosted Oct 12, 2020, 1:51 PM
Amit GuptaPosted Oct 12, 2020, 1:48 PM
Kobus BurgerPosted Oct 12, 2020, 1:38 PM
Mageshwaran RPosted Oct 12, 2020, 10:58 AM
Sachin SinghPosted Oct 12, 2020, 9:59 AM