XLL+ Class Library

CXlMacros::WorkbookMove

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

[C++]
static int WorkbookMove(
   const char* sheet_name,
   const char* dest_book,
   int position_num
);

Parameters

sheet_name

Sheet_name is the name of the sheet to move.

dest_book

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

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.

Remarks

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

Requirements

Header: xlfuncs.h

See Also

CXlMacros Class | CXlMacros Methods