LabWindows/CVI

ExcelRpt_Sort

HRESULT ExcelRpt_Sort (CAObjHandle worksheetHandle, char cellRange[], char primarySortKey[], enum ExREnum_ExSortOrder primarySortOrder, char secondarySortKey[], enum ExREnum_ExSortOrder secondarySortOrder, enum ExREnum_ExSortOrientation sortKeyOrientation, enum ExREnum_ExYesNo header);

Purpose

Sorts the contents of the cell range.

Parameters

Input
Name Type Description
worksheetHandle CAObjHandle A handle to an Excel Worksheet object.
cellRange char [] The range of cells to sort.

This value should be a string containing the cell range, such as "A1" or "A1:D5".
primarySortKey char [] The range of a cell in the row or column used as the primary sort key. To sort a range of cells according to the value in column A, pass the range of any cell in column A such as "A1".
primarySortOrder enum ExREnum_ExSortOrder Specify the sort order for the primary sort key. It must be one of the following values:

ExRConst_Ascending = 1
ExRConst_Descending = 2
secondarySortKey char [] The range of a cell in the row or column used as the secondary sort key. To sort a range of cells according to the value in column A, pass the range of any cell in column A such as "A1".

Pass 0 to specify no secondary sort key.
secondarySortOrder enum ExREnum_ExSortOrder Specify the sort order for the secondary sort key. It must be one of the following values:

ExRConst_Ascending = 1
ExRConst_Descending = 2
sortKeyOrientation enum ExREnum_ExSortOrientation Specify whether the sort keys refer to columns or rows. To sort a range of cells according to the values in column A, select columns. It must be one of the following values:

ExRConst_SortColumns = 1
ExRConst_SortRows = 2
header enum ExREnum_ExYesNo Specify whether the first row or column of the range contains headers. It must be one of the following values:

ExRConst_Yes = 1
ExRConst_No = 2

Return Value

Name Type Description
status HRESULT A value indicating whether an error occurred. Function failure is indicated by a negative error code.

Error codes are defined in CVIversion\include\cviauto.h and <Program Files>\National Instruments\Shared\MSDTRedistributables\SDKHeaderFiles\8.1\winerror.h.

You can use CA_GetAutomationErrorString to get the description of an error code.

Additional Information

Library: Excel Report

Include file: activex\excel\ExcelReport.h

LabWindows/CVI compatibility: LabWindows/CVI 7.0 and later

Log in to get a better experience