'vbs-файл; VladSh
Dim objXL
Set objXL = CreateObject("Excel.Application")
If Not objXL Is Nothing Then
objXL.Visible = True
fileName = "%FILENAMEDATA1%"
xlXmlLoadOption = 2 'xlXmlLoadImportToList
Call objXL.Workbooks.OpenXML(fileName,, xlXmlLoadOption)
Set ActiveSheet = objXL.ActiveSheet
rowCount = ActiveSheet.ListObjects.Count
If rowCount <> 0 Then
Set UsedRange = ActiveSheet.UsedRange
SPEC_ELEMENT_SORT = "%COLUMNSORTNAME%"
Dim colNum
For i = 1 To ActiveSheet.ListObjects(rowCount).ListColumns.Count
If CStr(UsedRange.Cells(1, i).Value) = SPEC_ELEMENT_SORT Then
colNum = i
Exit For
End If
Next
'если не найдено, не сортируем!
If colNum <> 0 Then
'имя колонки, по которой будем сортировать
cName = Replace(UsedRange.Cells(1, colNum).Address(0, 0), 1, "") + "1"
Set objRange = objXL.Range(cName)
objRange.Select
xlYes = 1
MatchCase = False
UsedRange.Sort objRange,,,,,,,xlYes,,MatchCase
End If
End If
End If