You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
duncanwerner edited this page Jun 30, 2014
·
10 revisions
BERT is an XLL Excel Add-in, which means it can use the Excel C API. This is a powerful, and potentially dangerous, way to interact with Excel. It is generally faster than using COM (like VBA) because it does not have any abstraction.
The file ExcelFunctions.R included in the BERT install directory includes a number of helper functions which call various Excel functions. These should be easier to use than using the Excel API directly.
Excel Functions
Internal Details
BERT installs a function Excel, in the BERT environment, which wraps the Excel API callback function. It also installs a wrapper class xlRefClass for Excel References. When R code calls the Excel callback function, any Excel references are returned as the xlRefClass type. Similarly if you pass this class to the Excel function, BERT will construct Excel References.
To call the Excel API directly, use the function Excel in the BERT environment. The first parameter is the Excel API function number. The second parameter is a list containing any arguments. For each argument, type conversion between Excel and R is handled as elsewhere in BERT, except that Excel references are translated into the xlRefClass type and vice-versa.