Sort data with Excel via COM
Posted: 23 Feb 2018, 05:43
Hello,
i need to sort data in an Excel sheet.
The default VBA code for sorting is this
I tried to "translate" it in the COM method like this:
But the compiler return me this error
Call to nonexistent function.
Specifically: Range(“E1”), Order1:=XLAscending, Header:=XLYes
Could someone help me with the correct syntax?
Thank you very much
i need to sort data in an Excel sheet.
The default VBA code for sorting is this
Code: Select all
Range(“A1”).CurrentRegion.Sort _
Key1:=Range(“E1”), _
Order1:=XLAscending, _
Header:=XLYes
Code: Select all
oExcel:=ComObjActive("Excel.Application")
oExcel.ActiveSheet.Range(“A1”).CurrentRegion.Sort Key1:=Range(“E1”), Order1:=XLAscending, Header:=XLYes
Call to nonexistent function.
Specifically: Range(“E1”), Order1:=XLAscending, Header:=XLYes
Could someone help me with the correct syntax?
Thank you very much