XLL+ Class Library


Returns a list of all the sheets in a workbook

static int WorkbookGetWorksheetNames(
   std::vector<CString>& vecSheetNames,
   const char* name_text = 0,
   bool complete_names = false



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


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


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.

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.


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.


Header: xlfuncs.h

See Also

CXlMacros Class | CXlMacros Methods