Set the formula of the referenced cell, in local format
BOOL SetFormula( const TCHAR* pszFormula, BOOL bArray = FALSE, BOOL bA1 = TRUE ) const; |
String buffer containing the formula. The formula is assumed to be in the current language (i.e. in "local" form), using punctuation derived from the user's regional settings, and function names derived from the Excel version.
If the formula is not in the correct format for the current settings, then the call will fail. To use a formula which works under all language settings, see CXlOper::SetFormulaIntl.
TRUE if the target should be filled with an array formula; FALSE if each cell should be filled with a standard formula.
If TRUE, then the formula should contain references in A1 format; if FALSE, the references should be in RC format.
Returns TRUE if the function was successful, FALSE if it failed. The function can fail if the CXlOper does not contain a reference, if the formula is invalid, or if the function cannot be run in Excel at this time.
This function can only be called from macro functions. It will always fail if called from worksheet functions.
Be careful when setting formulae that the formula is formatted correctly for the current language settings. For example, arguments in English are separated by commas; in German, semi-colons are used.
You can use CXllApp::GetInternational to get the current list separators and other punctuation characters.
Alternatively, you can use CXlOper::SetFormulaIntl to apply formulae that work in all languages.
Before XLL+ version 4.3.1, this method contained a bug which caused relative addresses to be wrongly transformed. This has now been fixed.
Header: xllplus.h
CXlOper Class | CXlOper Methods | CXlOper::GetFormula() | CXlOper::ConvertFormula() | CXllApp::GetInternational() | CXlOper::SetFormulaIntl()