M
mike11d11
I was able to create three worksheets in my workbook, but when I go to
add the 4th I get an Invalid Index error. I must be leaving something
out to when adding 4 or more sheets. Thanks
Dim oExcel As Object
Dim oBook As Object
Dim oSheet1500 As Object
Dim oSheetARPPD As Object
Dim oSheetDFDDNA As Object
Dim oSheetDNE As Object
'Start a new workbook in Excel.
oExcel = CreateObject("Excel.Application")
oBook = oExcel.Workbooks.Add
oSheet1500 = oBook.Worksheets(1)
oSheetARPPD = oBook.Worksheets(2)
oSheetDFDDNA = oBook.Worksheets(3)
oSheetDNE = oBook.Worksheets(4)
'Name teh sheets
oSheet1500.name = "1500"
oSheetARPPD.name = "AR-PPD"
oSheetDFDDNA.name = "DFD-DNA"
oSheetDNE.name = "DNE"
'oSheetEOB.name = "EOB"
add the 4th I get an Invalid Index error. I must be leaving something
out to when adding 4 or more sheets. Thanks
Dim oExcel As Object
Dim oBook As Object
Dim oSheet1500 As Object
Dim oSheetARPPD As Object
Dim oSheetDFDDNA As Object
Dim oSheetDNE As Object
'Start a new workbook in Excel.
oExcel = CreateObject("Excel.Application")
oBook = oExcel.Workbooks.Add
oSheet1500 = oBook.Worksheets(1)
oSheetARPPD = oBook.Worksheets(2)
oSheetDFDDNA = oBook.Worksheets(3)
oSheetDNE = oBook.Worksheets(4)
'Name teh sheets
oSheet1500.name = "1500"
oSheetARPPD.name = "AR-PPD"
oSheetDFDDNA.name = "DFD-DNA"
oSheetDNE.name = "DNE"
'oSheetEOB.name = "EOB"