LabWindows/CVI

ExcelRpt_Find

HRESULT ExcelRpt_Find (CAObjHandle worksheetHandle, enum ExREnum_ExDataType searchDataType, void *searchData, char afterCell[], enum ExREnum_ExFindLookIn lookIn, enum ExREnum_ExLookAt lookAt, enum ExREnum_ExSearchOrder searchOrder, enum ExREnum_ExSearchDirection searchDirection, int matchCase, int matchByte, char foundCellRange[]);

Purpose

Searches a worksheet for the specified information.

Parameters

Input
Name Type Description
worksheetHandle CAObjHandle A handle to an Excel Worksheet object.
searchDataType enum ExREnum_ExDataType Select the data type of the search data. The data type must be one of the following values. You can use the ExRConst_dataEmpty type to search for empty cells in the worksheet.

ExRConst_dataDouble = CAVT_DOUBLE
ExRConst_dataString = CAVT_CSTRING
ExRConst_dataCurrency = CAVT_CY
ExRConst_dataDate = CAVT_DATE
ExRConst_dataEmpty = CAVT_EMPTY
searchData void * The data to search for in the worksheet. The table below specifies the type of parameter value that should be passed based on the selected Search Data Type.

Search Data TypeParameter Type
ExRConst_dataString char *
ExRConst_dataDouble double *
ExRConst_dataCurrency CURRENCY *
ExRConst_dataDate DATE *
ExRConst_dataEmpty <none> Pass 0
afterCell char [] The cell to begin searching after.

This value is a string identifying the cell, such as "A1" or "$A$1".
lookIn enum ExREnum_ExFindLookIn Select which part of a cell the search should examine. Must be one of the following values:

ExRConst_Values = –4163
ExRConst_Comments = –4144
ExRConst_Formulas = –4123
lookAt enum ExREnum_ExLookAt Specify whether the search data must match the whole cell value or any part of the cell value.

Must be one of the following values:

ExRConst_Whole = 1
ExRConst_Part = 2
searchOrder enum ExREnum_ExSearchOrder Specify whether to search in row order or column order. Must be one of the following values:

ExRConst_ByRows = 1
ExRConst_ByColumns = 2
searchDirection enum ExREnum_ExSearchDirection Specify whether to search for the next match or the previous match.

ExRConst_Next = 1
ExRConst_Previous = 2
matchCase int Specify a nonzero value or select On in the function panel to match characters on a case-sensitive basis.

Specify 0 or select Off in the function panel to match characters on a case-insensitive basis.
matchByte int Specify a nonzero value or select On in the function panel to match double-byte characters only against double-byte characters.

Specify 0 or select Off in the function panel to match double-byte characters against equivalent single–byte characters.

This value matters only if double–byte language support is being used.
Output
Name Type Description
foundCellRange char [] A string buffer containing the range of the cell that matched the search criteria. This string will be empty if no cell matches the search criteria.

You must pass a string buffer at least size MAX_FOUND_CELLRANGE_LENGTH.

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