Move the specified worksheet to the destination workbook
Minimum Origin Version Required: 8.5 SR0
wmove_sheet source:=2! target:=<new> name:=abc$;
wmove_sheet source:=1! target:=[book1] name:=wksname$ index:=2;
See the syntax here.
This X-function is used to move the specified worksheet to the destination workbook. If a plot is created from the source worksheet, the plot will not be changed or removed when moving the worksheet.
The following scripts show you an example of moving a worksheet to the destination workbook, using the wmove_sheet X-function.
string path$ = system.path.program$ + "Samples\Import and Export\";
string fn1$ = path$ + "F1.dat";
string fn2$ = path$ + "F2.dat";
string fn3$ = path$ + "F3.dat";
string fn$=fn1$ + char(10)$ + fn2$ + char(10)$ + fn3$;
options.ImpMode:=4 // start with a new book
options.Names.FNameToSht:=0 // turn off rename sheet to file name
options.Names.FNameToBk:=0; // turn off rename book to file name
newbook name:="move_destination" sheet:=3;
// move the first worksheet in Book1 to be the second worksheet of the "move_destination" workbook
wmove_sheet source:=[Book1]1! target:=[move_destination] name:=wksname$ index:=2;
// should return Sheet4,
// which shows that the moved sheet name has been changed from "Sheet1" to "Sheet4"
// since there already was a "Sheet1" in the destination workbook