Excel Datei laden

Diese Seite verwendet Cookies. Durch die Nutzung unserer Seite erklären Sie sich damit einverstanden, dass wir Cookies setzen. Weitere Informationen

  • Excel Datei laden

    Ein herzliches Hallo.

    ich bin gerade dabei ein Excelsheet zu öffnen.

    Der Code dafür sieht wie folgt aus:

    Quellcode

    1. void excel::RunExcel(System::String ^sPath, bool bVisible/*=true*/)
    2. {
    3. // New Excel Application
    4. sPath->Format("L:\\Wifi\\Verrechnungssystem\\_excel\\Abrechnung 2009-05.xls");
    5. System::Object^ wb;
    6. Excel::Application^ pxlApp = gcnew Excel::ApplicationClass();
    7. // Add a Workbook
    8. Excel::Workbook^ pWb;
    9. pxlApp->Workbooks->Add(System::Type::Missing);
    10. pWb->Open(wb,sPath);
    11. //4. Assign the Active Worksheet to a variable
    12. Excel::Worksheet^ ws = static_cast<Excel::Worksheet^>(pxlApp->ActiveSheet);
    13. pxlApp->Visible = bVisible;
    14. return;
    15. }
    Alles anzeigen


    Mein Problem liegt darin, dass ich mit

    Quellcode

    1. pWb->Open(wb,"F:\\Verrechnungssystem\\_excel\\Abrechnung 2009-05.xls");


    kein existierendes Excel öffnen kann, sondern immer eine Fehlermeldung bekomme:


    1>------ Build started: Project: FIBU, Configuration: Debug Win32 ------
    1>Compiling...
    1>excel.cpp
    1>.\excel.cpp(22) : error C3728: 'event Microsoft::Office::Interop::Excel::WorkbookEvents_OpenEventHandler ^Microsoft::Office::Interop::Excel::WorkbookEvents_Event::Open': event does not have a raise method
    1>Build log was saved at "file://l:\Wifi\Verrechnungssystem\Projekt\Verrechnungssystem\FIBU\FIBU\Debug\BuildLog.htm"
    1>FIBU - 1 error(s), 0 warning(s)
    ========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========


    Hat jemand hier nen Rat?

    Vielen Dank