XLS Object
 
Syntax
 
XLS.MoveWorkSheet [shName, ][shBefore, ][shAfter]
 
Description
Reorders a worksheet in the tabs of the active workbook.
 
This method uses the standard Excel Move instruction for worksheet. A move instructions can only be accomplished by defining before or after which worksheet the moving worksheet must be placed.
 
Note: Either shBefore or shAfter must be a value assigned to. When both parameters have values assigned to, shAfter is ignored.
 
Parameter
Description
shName
String, optional. The name of the worksheet being moved. If omitted or when an empty string, the active worksheet will be moved.
shBehore
String, optional. The name of the worksheet where the moving worksheet will move in front to.
shAfter
String, optional. The name of the worksheet where the moving worksheet wil move behind to.
 
WARNING: moving worksheets around in a Excel workbook can cause an inpredictable error, code 1004. This is due to restrictions in Excel and is NOT a Tradium error message.
 
See Also
Example
 
Sub Main
 
Dim mySheets() As String
Dim x As Integer
 
   If Not XLS.AppInit() Then Exit Sub
 
   XLS.AppVisible = True
 
   XLS.AddWorkBook
   XLS.AddWorkSheet "Test1"
   XLS.AddWorkSheet "Test2"
   XLS.AddWorkSheet "Test3"
   XLS.AddWorkSheet "Test4"
 
   XLS.SaveWorkBook , "o:\AdminSQL\Scripts\mijntest.xlsx"
 
   XLS.MoveWorkSheet , , "Test1"
 
   XLS.ListWorkSheets mySheets()
 
   For x = 1 To UBound(mySheets)
      Debug.Print mySheets(x)
   Next x
 
   XLS.AppClose
 
End Sub