I added a bunch of sheets in my vsto project and had them renamed but can't rearrange them . tried using some vba for inspiration.
Dim addSheets As Excel.Sheets = Globals.ThisAddIn.Application.Sheets
addSheets.Add()
addSheets.Add()
addSheets.Add()
Dim sheetRename As Excel.Worksheet = Globals.ThisAddIn.Application.Sheets("Sheet1")
sheetRename.Name = "Raw SAP"
sheetRename = Globals.ThisAddIn.Application.Sheets("Sheet2")
sheetRename.Name = "Territory Summary"
sheetRename = Globals.ThisAddIn.Application.Sheets("Sheet3")
sheetRename.Name = "Customer Summary"
sheetRename = Globals.ThisAddIn.Application.Sheets("Sheet4")
sheetRename.Name = "Product Summary"
sheetRename = Globals.ThisAddIn.Application.Worksheets(1)
sheetRename = Globals.ThisAddIn.Application.Sheets("Territory Summary")
sheetRename.Move(After:=4)
System.Runtime.InteropServices.COMException
HResult=0x800A03EC
Message=Exception from HRESULT: 0x800A03EC
Source=<Cannot evaluate the exception source>
StackTrace:
<Cannot evaluate the exception stack trace>