XLL+ Class Library


Copies a worksheet from the current workbook to another workbook or to a new position in the current workbook

static int WorkbookCopy(
   const char* sheet_name,
   const char* dest_book,
   int position_num



Sheet_name is the name of the sheet to copy.


Dest_book is the name of the book to which the sheet will be copied. If it is NULL or empty, then a new book will be created. If it is the same as the active book (use CXlMacros::GetActiveWorkbookName to get the name of the active book), then the sheet will be copied to a new position within the active book.


Position_num is a number that specifies the target position for the sheet within dest_book. The first position is 1. You can use CXlMacros::WorkbookGetWorksheetCount to get the number of sheets in the current book.

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.


See the Microsoft Excel on-line Help for full details about this function.


Header: xlfuncs.h

See Also

CXlMacros Class | CXlMacros Methods