XLL+ Class Library (7.0)

CXlMacros::WorkbookGetWorksheetNames

Returns a list of all the sheets in a workbook

static int WorkbookGetWorksheetNames(
   std::vector<CString>& vecSheetNames,
   LPCTSTR name_text = 0,
   bool complete_names = false
);
static int WorkbookGetWorksheetNames(
   std::vector<CStringA>& vecSheetNamesA,
   LPCSTR name_text_a = 0,
   bool complete_names = false
);
static int WorkbookGetWorksheetNames(
   std::vector<CStringW>& vecSheetNamesW,
   LPCWSTR name_text_w = 0,
   bool complete_names = false
);

Parameters

vecSheetNames

A reference to a collection of strings that will be cleared and populated with sheet names if the function succeeds.

name_text

Name_text is the name of an open workbook. If omitted, the active workbook is used.

complete_names

Complete_names is a boolean value that controls whether the returned names will be in complete form (i.e. book[sheet]), or in short form (sheet). If omitted, the short form will be used.

vecSheetNamesA

A reference to a collection of ANSI strings that will be cleared and populated with sheet names if the function succeeds.

name_text_a

Name_text_a is the name of an open workbook. If omitted, the active workbook is used.

vecSheetNamesW

A reference to a collection of ANSI strings that will be cleared and populated with sheet names if the function succeeds.

name_text_w

Name_text_w is the name of an open workbook. If omitted, the active workbook is used.

Return Value

Zero if the function has been called successfully; non-zero if the function could not be called. See Error codes for a list of return values.

Remarks

This a helper function that calls GET.WORKBOOK(2) and extracts the resulting array into a vector of strings. around See the Microsoft Excel on-line Help for full details about this function.

Requirements

Header: xlfuncs.h

See Also

CXlMacros Class | CXlMacros Methods