Why does that happen. I simply want any new worksheet to join the existing worksheets but after the existing worksheets.
VB Code:
Dim FileName As String Dim UserPassword As String UserPassword = "letmein" FileName = textbox1.text Dim objExcel As New Excel.Application Dim oExcelWB As Excel.Workbook Dim oExcelWS As Excel.Worksheet objExcel = CType(CreateObject("Excel.Application"), Excel.Application) objExcel.Visible = False oExcelWB = objExcel.Workbooks.Add() 'RENAME EXISTING 3 WORKSHEETS objExcel.Worksheets(1).name = "OPTION 1" objExcel.Worksheets(2).name = "OPTION 2" objExcel.Worksheets(3).name = "OPTION 3" 'ADD NEW WORKSHEET oExcelWS = objExcel.Worksheets.Add() oExcelWS.Name = "OPTION 4" oExcelWB.Close(True, "D:\My Documents\" & FileName & ".xls") oExcelWB = Nothing
When I open the excel workbook the order is - Option 4 - Option 3 - etc...
I need it to go 1 - 2 - 3 - 4




Reply With Quote