XLL+ Class Library (7.0)


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

static int WorkbookMove(
   LPCTSTR sheet_name,
   LPCTSTR dest_book,
   int position_num



Sheet_name is the name of the sheet to move.


Dest_book is the name of the book to which the sheet will be moved. 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 moved 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