Click to Rate and Give Feedback
MSDN
MSDN Library
Office Development
Excel 2007
Getting Started
 Known Issues
Known Issues in Excel XLL Development

This topic describes known issues in Microsoft Office Excel that you might encounter in XLL development.

Unregistering XLL Commands and Functions

When an XLL registers a function or command, Excel creates a new name for the resource and associates a reference to the DLL function with that name. The name is taken from the fourth argument supplied to the xlfRegister function. This name is hidden from the normal dialog boxes for managing worksheet names. To unregister a function or command, you must delete the name by using the xlfSetName function, passing the name but not passing a definition. However, a bug prevents this from removing the name from the Function Wizard lists.

Argument Description String Truncation in the Function Wizard

Arguments 11 onwards to the function xlfRegister are optional strings corresponding to the arguments of the XLL function. The Function Wizard displays these to provide help in the argument construction dialog box. Sometimes Excel truncates the string that corresponds to the final argument by one or two characters when displaying it in the dialog box. You can avoid this by adding one or two spaces to the end of the final string.

Binary Name Scope Limitation

Binary names and their data can only be retrieved when the worksheet that was active at the time they were created is again active. Because worksheet functions cannot activate worksheets within a workbook (only commands can do this), applications of binary names are very limited. If you have a command that is only invoked from a particular worksheet, you could use a binary name to store command-related data, for example.

xlSet and Workbooks with Array Formulas

In Excel 2003 and earlier versions, the xlSet function fails if you try to assign values to a range on a worksheet that is not the active worksheet, where the equivalent range on the active sheet contains an array formula. In this case, Excel displays the message "You cannot change part of an array." This has been fixed in Excel 2007.

Circular References are Tolerated in Data Tables

Excel currently does not complain if the calculation that a data table is based on refers to something in the table itself. As unlikely as this scenario might be, you should be careful when you are creating or modifying formulas that are used to calculate data table values.

Converting an Integer XLOPER12 to an XLOPER

Because the integer type xltypeInt in the XLOPER12 is a 32-bit signed integer, but it is only a 16-bit signed integer in the XLOPER, it is possible that some integer XLOPER12 values cannot be contained in an integer XLOPER. Where Excel 2007 is converting this type internally, it gets around this by converting the type to a floating point xltypeNum XLOPER.

The Framework function XLOper12ToXLOper mirrors this behavior to be consistent with Excel internally. You should be careful when you are calling this function to not assume that the returned XLOPER will always be xltypeInt; reading my_xloper.val.w gives a false value if the my_xloper type is xltypeNum.

Returning XLOPER or XLOPER12 by Modifying Arguments in Place

Excel 2007 and earlier versions permit the registration of functions that return an XLOPER or XLOPER12 by modifying an argument in place. However, if an XLOPER/XLOPER12 argument points to memory, and the pointer is then overwritten by the return value of the DLL function, Excel can leak memory. Excel does not display an error, but it might eventually crash. Also, if the DLL allocated memory for the return value, Excel might try to free that memory, thinking that it was allocated by itself, which could cause an immediate application crash. You should not use the technique of modifying XLOPER/XLOPER12 arguments in this way. All XLOPER or XLOPER12 arguments should be treated as strictly read-only.

For more information, see Memory Management in Excel 2007.

See Also

Tags What's this?: Add a tag
Community Content   What is Community Content?
Add new content RSS  Annotations
Converting the XLL's OLE Automation date into boost ptime and back      eGene   |   Edit   |   Show History
I was developing an Excel interface into a library that uses boost's ptime class to represent DateTime.
Here is what I use to convert between XLL's datetime (OA DateTime, OA Date, OLE Automation date) and boost ptime:

// modified from http://lists.boost.org/Archives/boost/2009/06/153413.php to improve speed and include ticks into conversion

#include<boost/date_time/date_defs.hpp>

#include

<boost/date_time/time_defs.hpp>

#include

<boost/date_time/time_duration.hpp>

#include

<boost/date_time/special_defs.hpp>

template<class time_type>

class oa_date_converter

{

public:

typedeftypename time_type::date_type date_type;

typedeftypename time_type::time_duration_type time_duration_type;

typedeftypename time_type::time_system_type::impl_type::int_type int_type;


static time_type from_oadate(double oa_date)

{

staticconst time_type base_time(date_type(1899, 12, 30), time_duration_type(0,0,0));

staticconst int_type ticks_per_day(86400 * time_duration_type::rep_type::res_adjust());

return base_time + time_duration_type(0, 0, 0, (int_type)(oa_date * ticks_per_day));

}


staticdouble to_oadate(time_type time)

{

staticconst time_type base_time(date_type(1899, 12, 30), time_duration_type(0,0,0));

staticconstdouble days_per_tick(1.0 / (86400 * time_duration_type::rep_type::res_adjust()));

return (time - base_time).ticks() * days_per_tick;

}

};

Tags What's this?: Add a tag
Flag as ContentBug
Processing
© 2009 Microsoft Corporation. All rights reserved. Terms of Use | Trademarks | Privacy Statement
Page view tracker