Keiner weiß was?
Hier ist meine Variante, klappt nur leider nicht...
Delphi-Quellcode:
excel.Application.SheetsInNewWorkBook := 1;
Excel.Workbooks.Add;
//Der Befehl hier existiert in Excel angeblich nicht:
Excel.ChDir('C:\Program Files\Borland\Delphi5\Projects\Währungsrechner\Datafiles');
Excel.Workbooks.OpenXML;
Excel.Filename:='C:\Program Files\Borland\Delphi5\Projects\Währungsrechner\Datafiles\eurofxref-hist.xml';
Excel.LoadOption:=Excel.xlXmlLoadImportToList;
Excel.Columns('A:B').Select;
Excel.Selection.Delete;
Excel.Shift:=Excel.xlToLeft;
Excel.ActiveWorkbook.SaveAs;
Excel.Filename:='C:\Program Files\Borland\Delphi5\Projects\Währungsrechner\Datafiles\Newdata.txt';
Excel.FileFormat:=Excel.xlText;
Excel.CreateBackup:=False;
Komplett also so:
Delphi-Quellcode:
procedure TForm1.Button1Click(Sender: TObject);
var
Excel : Variant;
begin
Excel := CreateOleObject('Excel.Application');
excel.Application.SheetsInNewWorkBook := 1;
Excel.Workbooks.Add;
Excel.ChDir('C:\Program Files\Borland\Delphi5\Projects\Währungsrechner\Datafiles');
Excel.Workbooks.OpenXML;
Excel.Filename:='C:\Program Files\Borland\Delphi5\Projects\Währungsrechner\Datafiles\eurofxref-hist.xml';
Excel.LoadOption:=Excel.xlXmlLoadImportToList;
Excel.Columns('A:B').Select;
Excel.Selection.Delete;
Excel.Shift:=Excel.xlToLeft;
Excel.ActiveWorkbook.SaveAs;
Excel.Filename:='C:\Program Files\Borland\Delphi5\Projects\Währungsrechner\Datafiles\Newdata.txt';
Excel.FileFormat:=Excel.xlText;
Excel.CreateBackup:=False;
end;
Wenn ich das CHDir weglasse, da es ja eigentlich nicht gebraucht wird, da es nur im Dialog ausgewählt wurde, Wird die Zeile darauf markiert und es kommt die Meldung: Ungültige Parameteranzahl
Hab das noch nie gemacht, wenn mir also einer sagen kann, wie man das macht, dann kann ich das sicher auf weitere Makros übertragen...
[edit=mkinzler]Code-Tag durch Delphi-Tag ersetzt Mfg, mkinzler[/edit]