XLL+ Class Library (7.0)


Get the formula in the referenced cell, in local format

BOOL GetFormulaW(
   CStringW& strFormula,
   BOOL& bIsArray,
   BOOL bA1 = TRUE
) const;



String buffer which will be filled with the formula. The formula will be in local form, as it appears in the Excel formula bar.


Will be set to TRUE if the cell is part of an array; to FALSE if it is not.


If TRUE, then the formula will contain references in A1 format; if FALSE, the references will 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, or if it cannot be run in Excel at this time.


This function can only be called from macro functions, or from worksheet functions that have been marked as "Defer recalculation". It will always fail if called from worksheet functions that have not been marked as "Defer recalculation".

International considerations

Be aware when inspecting a formula retrieved using this method that the formula is formatted 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::GetFormulaIntl to apply formulae that work in all languages.


Header: xllplus.h

See Also

CXlOper Class | CXlOper Methods | CXlOper::SetFormula() | CXlOper::ConvertFormula() | CXllApp::GetInternational() | CXlOper::GetFormulaIntl()