XLL+ Class Library (7.0)


Set the formula of the referenced cell, in English, for formulae of more than 255 characters

BOOL SetLongFormulaIntl(
   const TCHAR* pszFormula,
   BOOL bArray = FALSE,
   BOOL bA1 = TRUE
) const;



String buffer containing the formula. Formulae must contain less than 1024 characters.

The formula is assumed to be in English, using US English regional settings - i.e. arguments and lists are separated by commas; rows in arrays are separated by semi-colons; the full stop is used as a decimal point.

If the formula is not in the correct English format, then the call will fail. To use a formula which works using local language settings, see CXlOper::SetFormula.


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.

Return Value

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.

It makes use of the COM interface, and is much slower than CXlOper::SetFormulaIntl, SetFormulaIntl should always be used in preference to SetLongFormulaIntl, except for the rare case where a very long formula is unavoidable.

Note also that each of the literal values contained within the string must have 255 characters or less. The entire formula may have up to 1024 characters, but no single argument within it may have more than 255 characters.

International considerations

This method will work in all Excel language versions and under any user-selected regional settings. Note that all formulae must be in English.

Alternatively, you can use CXlOper::SetLongFormula to apply long formulae in the local language.


CXlOper::SetLongFormulaIntl() Example


Header: xllplus.h

See Also

CXlOper Class | CXlOper Methods | CXlOper::SetFormulaIntl() | CXlOper::SetLongFormula()