I’m porting an Excel add-in from visual VB to Delphi 2006. Most of it is working but I am stuck on these two VB lines:
oXL.Selection.QueryTable
oXL.Selection <> ""
where oXL is defined as Excel.Application.
In Delphi ExcelApplication.Selection requires an index but in VB it doesn’t. I couldn’t find anything similar in C# either. I have tried ExcelApplication.ActiveCell which works as long as there is an existing query, otherwise Excel crashes.
Does anyone know what this translates into for Delphi, or C#?
Also if oXL.Selection is an interface, how can you perform oXL.Selection <> “”?
Thank you.
No worries, I had forgotten that you can just cast the application IDispatch interface to an OleVariant and then call the method.
But what I’ve done instead is just the following
This seems to be the only way to make it work without crashing excel.