Hi there..
Can anyone give me the syntax to add multiple worksheets to a workbook?
The code that I have creates a new workbook each time it creates a sheet
and tried
And tried
All these bomb out on me either for referencing nothing (I think the (5) means worksheet 5??) and the final example gives me a "System.Runtime.InteropServices.COMException" error: Exception form HRESULT: 0x800A03EC
any help is gratefully appreciated..
Ta
Can anyone give me the syntax to add multiple worksheets to a workbook?
The code that I have creates a new workbook each time it creates a sheet
Code:
Dim oExcel As New Excel.Application
Dim oSheet1, oSheet2, oSheet3, oSheet4, oSheet5 as Excel.Worksheet
oExcel.Workbooks.Add.Worksheets(5)
and tried
Code:
oExcel.ActiveWorkbook.Worksheets.Add(1,5,5,)
And tried
Code:
oExcel.Sheets.Add(5)
All these bomb out on me either for referencing nothing (I think the (5) means worksheet 5??) and the final example gives me a "System.Runtime.InteropServices.COMException" error: Exception form HRESULT: 0x800A03EC
any help is gratefully appreciated..
Ta