LabWindows/CVI

ExcelRpt_GetCellValue

HRESULT ExcelRpt_GetCellValue (CAObjHandle worksheetHandle, char cellRange[], enum ExREnum_ExDataType dataType, void *value);

Purpose

Gets the value of the cell.

Parameters

Input
Name Type Description
worksheetHandle CAObjHandle A handle to an Excel Worksheet object.
cellRange char [] The range of an individual cell. This value should be a string containing the cell range, such as "A1". If the range contains multiple cells, this function will examine the uppper leftmost cell in the range.
dataType enum ExREnum_ExDataType The type of the value parameter that will receive the cell value. This function will attempt to convert values to match the specified data type. Many values can be converted to doubles. Almost all values can be converted to strings.

You must select one of the following values:

ExRConst_dataShort = CAVT_SHORT
ExRConst_dataLong = CAVT_LONG
ExRConst_dataInt = CAVT_INT
ExRConst_dataFloat = CAVT_FLOAT
ExRConst_dataDouble = CAVT_DOUBLE
ExRConst_dataString = CAVT_CSTRING
ExRConst_dataCurrency = CAVT_CY
ExRConst_dataDate = CAVT_DATE
Output
Name Type Description
value void * The value of the cell.

The table below specifies the type of parameter that should be passed based on the selected value of the dataType parameter.

Data TypeParameter Type
ExRConst_dataShort short *
ExRConst_dataLong long *
ExRConst_dataInt int *
ExRConst_dataFloat float *
ExRConst_dataString char **
ExRConst_dataDouble double *
ExRConst_dataCurrency CURRENCY *
ExRConst_dataDate DATE *

String values should be freed with CA_FreeMemory.

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