Excel XLL CALL REGISTER DataTypes

I’ve lost track of the number of times I have had to search for this.

So now its going in a post.

From here:

Data type Pass by value Pass by ref (pointer) Comments
Boolean A L short (0=false or 1=true)
double B E
char * C, F Null-terminated ASCII byte string.
unsigned char * D, G Length -counted ASCII byte string.
unsigned short *
(starting in Excel 2007)
C%, F% Null-terminated Unicode wide character string.
unsigned short *
(starting in Excel 2007)
D%, G% Length-counted Unicode wide character string.
unsigned short [int] H WORD
[signed] short [int] I M 16-bit
[signed long] int J N 32-bit
Array O Passed as three arguments by reference: 

  1. short int *rows
  2. short int *columns
  3. double *array
Array 

(starting in Excel 2007)

O% Passed as three arguments by reference: 

  1. int *rows
  2. int *columns
  3. double *array
FP K Floating-point array structure.
FP12 

(starting in Excel 2007)

K% Large grid floating-point array structure.
XLOPER P Variable-type worksheet values and arrays.
R Values, arrays, and range references.
XLOPER12 

(starting in Excel 2007)

Q Variable-type worksheet values and arrays.
U Values, arrays, and range references.

The types C%, F%, D%, G%, K%, O%, Q, and U were all new in Microsoft Office Excel 2007 and are not supported in earlier versions. The string types F, F%, G, and G% are used for arguments that are modified-in-place. When XLOPER or XLOPER12 arguments are registered as types P or Q respectively, Excel converts single-cell references to simple values and multi-cell references to arrays when it prepares them.

P and Q types always arrive in your function as one of the following types: xltypeNum, xltypeStr, xltypeBool, xltypeErr, xltypeMulti, xltypeMissing, or xltypeNil, but not xltypeRef or xltypeSRef because these are always dereferenced.

Type O, which is really three arguments on the stack, was introduced for compatibility with Fortran DLLs where arguments are passed by reference. It cannot be used to return a value except by declaring the argument as a modify-in-place return value and placing the results in the referenced values. Type O% extends type O in Excel 2007 so that it can access arrays that cover areas larger than the Office Excel 2003 grid.

So lets hope I can remember the search term eh?

cheers

Simon

Advertisements

3 Responses to “Excel XLL CALL REGISTER DataTypes”

  1. Claire Says:

    Just what I (really really) needed. Pasting this onto a sticky note right now, thanks!

  2. Keith Says:

    I just #define XLL_BOOL “A” … #define XLL_LPXLOPER “P” in a header file that I include. You can then use the C preprocessor string pasting to write, e.g., XLL_BOOL XLL_LPXLOPER to produce “AP” for a function that returns a BOOL and takes an LPXLOPER.

    Here is a link to a file with these #defines: http://xll.codeplex.com/SourceControl/changeset/view/5592#74319

  3. Melog: HTAからWin32APIにマルチバイト文字を渡す Says:

    […] Excel 2007 のアドイン (XLL) の開発 Excel XLL CALL REGISTER DataTypes | Smurf on Spreadsheets […]

Leave a Reply

Please log in using one of these methods to post your comment:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s


%d bloggers like this: