cs.andras
Active Member
Hi,
Has anyone done such a thing? I've tried to modify my copy of MS Excel VBO, adding a new page (action) based on the Select method, but got HRESULT: 0x800A03EC on the Range command when ran the code stage.
Thanks,
Andras
The code I wrote is:
Has anyone done such a thing? I've tried to modify my copy of MS Excel VBO, adding a new page (action) based on the Select method, but got HRESULT: 0x800A03EC on the Range command when ran the code stage.
Thanks,
Andras
The code I wrote is:
Code:
Dim wb, ws As Object
Dim excel, sheet, Range As Object
Try
wb = GetWorkbook(Handle, Workbook)
ws = GetWorksheet(Handle, Workbook, Worksheet)
wb.Activate()
ws.Activate()
excel = ws.Application
sheet = excel.ActiveSheet
Range = sheet.Range(SortableRange)
Range.Select()
ws.Sort.SortFields.Clear
Dim i as Integer
For i = 1 To SortingColumns.Rows.Count
ws.Sort.SortFields.Add (Key:=Range(SortingColumns.rows.item(i).item(1)), SortOn:=Excel.xlSortOnValues, Order:=Excel.xlAscending, DataOption:=Excel.xlSortNormal)
Next i
ws.Sort.SetRange (Range(SortableRange))
ws.Sort.Header = Excel.xlGuess
ws.Sort.MatchCase = False
ws.Sort.Orientation = Excel.xlTopToBottom
ws.Sort.SortMethod = Excel.xlPinYin
ws.Sort.Apply
Success = True
Catch e As Exception
Success = False
Message = e.Message
Finally
wb = Nothing
ws = Nothing
excel = Nothing
sheet = Nothing
range = Nothing
End Try
Last edited: