Excel App Cells().Value

  • VB.NET

Es gibt 2 Antworten in diesem Thema. Der letzte Beitrag () ist von _PASCAL_.

    Excel App Cells().Value

    Hallo,

    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

    1. Public Sub write_excel()
    2. Dim xlApp As Excel.Application
    3. Dim xlWorkbook As Excel.Workbook
    4. Dim xlSheet As Excel.Worksheet
    5. xlApp = New Excel.Application
    6. xlApp.Visible = False
    7. xlWorkbook = xlApp.Workbooks.Add
    8. For Each mes In messurements.Values
    9. xlSheet = xlWorkbook.Worksheets.Add
    10. xlSheet.Name = "Ergebnisse" & mes.name
    11. With xlSheet
    12. For Each cal In mes.calculation
    13. .Cells(2, mes.calculation.IndexOf(cal)).Value = "TEST" 'Join(cal.column.ToArray, " ")
    14. For i As Integer = 3 To messurements.First.Value.calculation.First.result.Count
    15. .Cells(i, mes.calculation.IndexOf(cal)).Value = cal.result(i)
    16. Next
    17. Next
    18. End With
    19. Next
    20. xlWorkbook.SaveAs(Application.StartupPath & "\test")
    21. xlApp.Quit()
    22. 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ß