Skip to main content
Version: v6.5.0

Read formulas from cells

Command Description

Read formulas from specified cells in the worksheet, supporting both regular and array formulas

Command Prototype

sRet = Excel.ReadFormula(objExcelWorkBook,sheet,strCell)

Command parameter

parametermandatorytypedefault valueInstructions
objExcelWorkBookTrueexpressionobjExcelWorkBookWorkbook objects returned by the Open Excel Workbook command (Excel. Open) or Bind Excel Workbook command (Excel. BindBook)
sheetTruestring"Sheet1"If a string is used, it represents the name of the specified worksheet; Using numbers indicates the order of the specified worksheet (starting from 0)
strCellTruestring"A1"The specified cell supports both cell names such as "A1" and row column arrays such as [row number, column number]. When using cell names, they are not case sensitive

Return result

SRet, Assign the result of running the command to this variable.

Run instance

/*********************************Read Cell Formula***********************************
Command Prototype:
sRet = Excel.ReadFormula(objExcelWorkBook,sheet,strCell)
Input Parameters:
objExcelWorkBook -- Workbook object. Note: The workbook object returned by the "Open Excel Workbook" command (Excel.Open) or the "Bind Excel Workbook" command (Excel.BindBook).
sheet -- Worksheet. Note: If using a string, it represents the name of the specified worksheet; if using a number, it represents the index of the specified worksheet (starting from 0).
strCell -- Cell. Note: The specified cell, supports both cell names (e.g., "A1") and row-column arrays (e.g., [row number, column number]). Cell names are case-insensitive.
Output Parameter:
sRet -- The variable where the output of the function call will be saved.
Notes:
None
********************************************************************************/
Dim sRet = ""
sRet = Excel.ReadFormula(objExcelWorkBook,"Sheet1","A1")
TracePrint(sRet)