I am trying to sort a column in excel using Blueprism. I have enhanced the Excel VBO with the following code
GetInstance(handle).Sort.SortFields.Add2 (Key:=Range(Range))
The code compiles, but when I run it I get the following error
Internal : Could not execute code stage because exception thrown by code stage: Exception from HRESULT: 0x800A03EC
GetInstance(handle)
returns only the instance of Excel.Application
mapped to that handle
. Excel.Application
doesn't have a Sort
property.
Use a property of the instance like ActiveSheet
to apply the operation to a sheet (which has a Sort
property):
GetInstance(handle).ActiveSheet.Sort.SortFields.Add2 (Key:=Range(Range))