Download (direct link):
41 Returns the formula in the active cell without translation into the language set for the workspace.
46 True if the top left cell has a text note.
48 True if the top left cell contains a formula, false if constant.
49 True if the cell is part of an array formula.
52 If the top left cell is a string constant, the text alignment character ('), otherwise empty text ("").
53 The top left cell as displayed, converted to text, including formatting numbers and symbols.
62 The name of the workbook and the current sheet in the form [Bookl ,xls]Sheet1.
66 The workbook name containing the range in the form Book1.xls.
The Excel4() function set-up and call would be as shown in the following C/C++ code. This is an example of an exportable function that simply wraps up the call to xlfGetCell and returns whatever is returned from that call.
Accessing Excel Functionality Using the C API
xloper * stdcall get_cell(int arg_num, xloper *p_ref)
static xloper ret_xloper;
arg.xltype = xltypeInt; arg.val.w = arg_num;
Excel4(xlfGetCell, &ret_xloper, 2, &arg1, p_ref);
// Tell Excel to free up memory that it might have allocated for // the return value.
ret_xloper.xltype |= xlbitXLFree;
Using the cpp_xloper class, the equivalent code would be:
xloper * stdcall get_cell(xloper *pRef, int arg_num)
cpp_xloper Arg(arg_num, 1, 66); cpp_xloper RetVal;
Excel4(xlfGetCell, &RetVal, 2, &Arg, pRef); return RetVal.ExtractXloper(true);
8.9.6 Sheet or workbook information: xlfGetDocument
Overview: The first argument corresponds to the information you are
trying to get. The second is the name of a sheet or workbook, depending on the context, about which you want to know something. The meaning of the most useful of these 88 values is given in Table 8.14.3 If the second argument is omitted, information about the active (not the current) sheet or workbook is returned.
Name can also be specified as workbook-and-sheet in the form [Book1.xls]Sheet1 where the context allows.
Enumeration value: 188 (xbc)
Callable from: Commands and macro sheet functions.
Return type: Various, depending on the value of the first argument.
Arguments: 1: ArgNum: A number from 1 to 88 inclusive.
2: Name: (Optional.) Sheet or workbook name as text.
3 For values not covered, see the Macro Sheet Function Help included with the Excel SDK.
Excel Add-in Development in C/C++
Table 8.14 Selected arguments to xlfGetDocument
ArgNum What the function returns
1 If Name is a sheet name: • If more than one sheet in the current workbook, returns the name of the sheet in the form [Bookl ,xls]Sheet1. • If only one sheet in the current workbook, but the name of the workbook is not Name, returns the sheet Name in the form [Bookl ,xls]Sheet1 • If only one sheet in the current workbook and the workbook and sheet are both called Name, returns the name of the workbook in the form Book1.xls • If sheet Name does not exist in the current workbook, returns #N/A If Name is a workbook name: • If more than one sheet in the given workbook, the name of the first sheet in the foim [Bookl ,xls]Sheet1 • If one sheet in the given workbook, and the sheet name is not also Name, the name of that sheet in the form [Bookl ,xls]Sheet1 • If one sheet with the same name as the given workbook, the name of the workbook in the form Bookl .xls • If workbook Name is not open, returns #N/A If Name is omitted: • If more than one sheet in the active workbook or the sheet name is not the same as the active workbook name, the name of the active sheet in the foim [Bookl ,xls]Sheet1. • If one sheet with the same name as the active workbook, the name of the workbook in the form Bookl .xls (See also ArgNum 76 and 88 below, which return the names of the active worksheet and the active workbook respectively.)
2 Path of the directory containing workbook Name if it has already been saved, else #N/A
3 A number indicating the type of sheet. If given. Name is either a sheet name or a workbook. If omitted the active sheet is assumed. If Name is a workbook, the function returns 5 unless the book has only one sheet with the same name as the book, in which case it returns the sheet type. 1 = Worksheet 2 = Chart 3 = Macro sheet 4 = Info window if active 5 = Reserved 6 = Module 7 = Dialog
Accessing Excel Functionality Using the C API
Table 8.14 (continued)
4 True if changes made to the sheet since last saved.
5 True if the sheet is read-only.
6 True if the sheet is password protected.
7 True if cells in the sheet or the series in a chart are protected.
8 True if the workbook windows are protected. (Name can be either a sheet name or a workbook. If omitted the active sheet is assumed.)
9 The first used row or 0 if the sheet is empty. (Counts from 1.)
10 The last used row or 0 if the sheet is empty. (Counts from 1.)
11 The first used column or 0 if the sheet is empty. (Counts from 1.)
12 The last used column or 0 if the sheet is empty. (Counts from 1.)