Hallo,
ich dreh gleich noch durch ... irgendwie funktioniert das dumme Excel nicht.
eigentlich will ich nur meine ergebnisse in ein neues Excel Dokument schreiben.
es kommt immer ein fehler wenn ich auf cells().Value zugreife bzw was schreiben will ... geht das bei VB 2010 mit Excel 12 nicht mehr ?
in VB6 hat das so wunderbar funktioniert und ich habe auch beispiele in VB 2010 gesehen wo das so funktioniert hat ... es kommt immer COMException wurde nicht behandelt ... Ausnahme von HRESULT: 0x800A03EC
Habt ihr eine Idee ?
Gruß
ich dreh gleich noch durch ... irgendwie funktioniert das dumme Excel nicht.
eigentlich will ich nur meine ergebnisse in ein neues Excel Dokument schreiben.
VB.NET-Quellcode
- Public Sub write_excel()
- Dim xlApp As Excel.Application
- Dim xlWorkbook As Excel.Workbook
- Dim xlSheet As Excel.Worksheet
- xlApp = New Excel.Application
- xlApp.Visible = False
- xlWorkbook = xlApp.Workbooks.Add
- For Each mes In messurements.Values
- xlSheet = xlWorkbook.Worksheets.Add
- xlSheet.Name = "Ergebnisse" & mes.name
- With xlSheet
- For Each cal In mes.calculation
- .Cells(2, mes.calculation.IndexOf(cal)).Value = "TEST" 'Join(cal.column.ToArray, " ")
- For i As Integer = 3 To messurements.First.Value.calculation.First.result.Count
- .Cells(i, mes.calculation.IndexOf(cal)).Value = cal.result(i)
- Next
- Next
- End With
- Next
- xlWorkbook.SaveAs(Application.StartupPath & "\test")
- xlApp.Quit()
- End Sub
es kommt immer ein fehler wenn ich auf cells().Value zugreife bzw was schreiben will ... geht das bei VB 2010 mit Excel 12 nicht mehr ?
in VB6 hat das so wunderbar funktioniert und ich habe auch beispiele in VB 2010 gesehen wo das so funktioniert hat ... es kommt immer COMException wurde nicht behandelt ... Ausnahme von HRESULT: 0x800A03EC
Habt ihr eine Idee ?
Gruß