A
Anthony
To me, creating Excel 2003 spreadsheets programmatically via VB.NET hasn't
really changed since the days of VB6.
That is, I'd do something similar to this
Code:
Dim ExcelApp As Excel.Application
Dim ExcelWB As Excel.Workbook
Dim ExcelWS As Excel.Worksheet
Try
'
' Create a Spreadsheet for the selected company
'
ExcelApp = New Excel.Application
ExcelWB = ExcelApp.Workbooks.Add
ExcelWS = CType(ExcelWB.ActiveSheet, Excel.Worksheet)
' ...etc
What I'm wondering is there a better way of doing this now in VB.NET. That
is, can we get away from adding a reference to Excel11. This is unmanaged
code. (COM). Isn't there a .NET reference that can be added?
Someone mentioned I could go along the XML path, where I'd be creating XML
documents and the user would open them in Excel, etc. But this seams very
limiting to me. I want to be able to create a spreadsheet programmatically
with all the bells and whistles.
Of course I can do this via the old method but I can't believe MS hasn't
progressed from the old days. Or am I missing something? Probably am.
You may be asking what's wrong with the old way? Well in my experiences some
machines would not cope with creating instances of the Excel.Application,
...I'd have to use CreateObject("Excel.Application") instead. If the
application crashed half way thru there would be a bunch of Excel.exe 's
sitting in the task Manager. Argh. I just don't think it is pretty.
Any suggestions on an improvement?
Thanks,
Anthony
really changed since the days of VB6.
That is, I'd do something similar to this
Code:
Dim ExcelApp As Excel.Application
Dim ExcelWB As Excel.Workbook
Dim ExcelWS As Excel.Worksheet
Try
'
' Create a Spreadsheet for the selected company
'
ExcelApp = New Excel.Application
ExcelWB = ExcelApp.Workbooks.Add
ExcelWS = CType(ExcelWB.ActiveSheet, Excel.Worksheet)
' ...etc
What I'm wondering is there a better way of doing this now in VB.NET. That
is, can we get away from adding a reference to Excel11. This is unmanaged
code. (COM). Isn't there a .NET reference that can be added?
Someone mentioned I could go along the XML path, where I'd be creating XML
documents and the user would open them in Excel, etc. But this seams very
limiting to me. I want to be able to create a spreadsheet programmatically
with all the bells and whistles.
Of course I can do this via the old method but I can't believe MS hasn't
progressed from the old days. Or am I missing something? Probably am.
You may be asking what's wrong with the old way? Well in my experiences some
machines would not cope with creating instances of the Excel.Application,
...I'd have to use CreateObject("Excel.Application") instead. If the
application crashed half way thru there would be a bunch of Excel.exe 's
sitting in the task Manager. Argh. I just don't think it is pretty.
Any suggestions on an improvement?
Thanks,
Anthony