Dateiname falsche Variable



  • Hi,
    habe jetzt schon lange das Forum und die FAQ durchsucht, aber komme einfach nicht drauf ... obwohl es so ein BILLIG problem ist...:
    Ich möchte durch einen OpenDialog eine Datei öffnen können, die dann in etwa so geöffnet werden soll:

    Excel.OlePropertyGet("WorkBooks").OleFunction("Open", OpenDialog1->Files );
    

    der Code selber:

    OpenDialog1->Execute();
    
    Variant Excel;
            Excel = Variant::CreateObject("Excel.Application");
            Excel.OlePropertyGet("ActiveWorkBook");
            // Excel-Datei öffnen
            Excel.OlePropertyGet("WorkBooks").OleFunction("Open", OpenDialog1->FileName );
            // Sichtbar machen
            Excel.OlePropertySet("Visible",1);
            Variant Sheet;
            Sheet=Excel.OlePropertyGet("ActiveSheet");
            ShowMessage(Sheet.OlePropertyGet("Cells",1,1).OlePropertyGet("Value"));
    

    Edit: Mein Problem hierbei ist, dass er mir sagt dass er einen falschen Variablen typ bekommt ... OpenDialog1->FileName ist ein AnsiString...



  • Danke habs schon... (ich Idiot...)

    folgendes:

    Excel.OlePropertyGet("WorkBooks").OleFunction("Open", OpenDialog1->FileName.c_str());
    

Anmelden zum Antworten