Morgen Leute,
Hab da so kleine Probleme,
Also ich öffne eine Excel-Tabelle und will jegliche Fehler wie z.B. :
- Datei nicht vorhanden
- Datei wird benutzt
- keine *.xls Datei (durch falsches Auswählen oder Umbenennen von z.B. *.txt in *.xls)
Leider hab ich keine ahnung wie ich das in den folgenden Code rein packe...
1: 2: 3: 4: 5: 6: 7: 8: 9: 10: 11: 12: 13: 14: 15: 16: 17: 18: 19: 20: 21: 22: 23: 24: 25: 26: 27: 28: 29: 30: 31: 32: 33: 34:
| procedure TfrmMain.btnUebertragenClick(Sender: TObject);
begin _lcid := GetUserDefaultLCID; XLApp := TExcelApplication.Create(Self); try XLApp.Connect; try XLApp.Workbooks.Open(c_sKartenAdresse , emptyParam, emptyParam, emptyParam, emptyParam, emptyParam, emptyParam, emptyParam, emptyParam, emptyParam, emptyParam, emptyParam, emptyParam, _lcid); WorkBk := XLApp.WorkBooks.Item[1]; WorkSheet := WorkBk.WorkSheets.Get_Item(1) as _WorkSheet;
call function LeseSpalteAnfang;
finally XLApp.Disconnect; end;
finally XLApp.Quit;
end;
end; |
Und vielleicht könnt ihr mir sagen ob man meine Lösung zum öffnen der Excel-Tabelle aus verbessern kann