|Important||This document may not represent best practices for current development, links to downloads and other resources may no longer be valid. Current recommended version can be found here.|
What's New in the C API for Excel 2007
This content is outdated and is no longer being maintained. It is provided as a courtesy for individuals who are still using these technologies. This page may contain URLs that were valid when originally published, but now link to sites or pages that no longer exist.
Microsoft Office Excel 2007 introduces a new user interface and several other significant changes. With Excel 2007 (version 12), the C API has been updated:
New worksheet functions are now available through the C API.
Analysis Toolpak functions are now available directly through the C API as worksheet functions. (Previously they were available only through the C API as user-defined functions.)
XLLs can register their worksheet functions as thread-safe.
Support for long Unicode strings, supported in several earlier versions of Excel, has been added.
Some new data types have been added to the C API that provide support for the much larger Excel 2007 grid.
In Excel 2003, the worksheet contained 256 columns x 65,536 rows (28 x 216). In Excel 2007, this was expanded to 16,384 x 1,048,576 (214 x 220)—that is, from 224 to 234 cells. These new limits overflow the integer types that were used to contain them in the old range and array structures. This made it necessary to have new data structures with wider integers to define the size of ranges and arrays.
In Excel 2003, any function, whether built-in or provided by an add-in, was limited to at most 30 arguments. In Excel 2007, this is increased to 255.
DLLs and XLLs can now exchange long Unicode strings with Excel instead of just the limited length byte strings supported in the old C API.
Excel 2007 introduces multithreaded workbook recalculation on single and multi-processor machines. Unlike VBA user-defined functions (UDFs) and other Excel UDF types, XLL UDFs can be registered as thread safe. This means that Excel can assign XLL UDFs and most of its own built-in worksheet functions to concurrent threads to speed up recalculation.
The Analysis Toolpak functions are fully integrated into Excel 2007, so the C API can access them directly, although the add-in is still required for the Data Analysis tools.
In all of these cases, you should consider backward-compatibility issues if you want to write add-ins that take advantage of these new changes but still work in earlier versions. Excel 2007 can run add-ins that were developed for earlier versions, but calling Analysis Toolpak functions via the C API must be handled differently. For more information and recommendations on how to write version-aware and version-safe add-ins, see Backward Compatibility.
The user interface in Excel 2007 has changed dramatically. Consequently, many of the user interface customization XLM functions and commands do not always work as intended. You should test your add-in thoroughly with Excel 2007 to ensure that your user-interface customizations are still appropriate for your purposes. MSDN provides more information about customizing the Excel 2007 user interface.