XLL+ Class Library (7.0)

CXlMacros::WorkbookCopy

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

static int WorkbookCopy(
   LPCTSTR sheet_name,
   LPCTSTR dest_book,
   int position_num
);

Parameters

sheet_name

Sheet_name is the name of the sheet to copy.

dest_book

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

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