Misio sam da preko OLE-a ucitam/snimi podatke iz/u excel/-a. E sada problem je sto mi aplikacija izbacuje runtime gresku.

Evo konkrtno procedure
Code:
procedure TForm1.napraviekselExecute(Sender: TObject);
var
XLApp: OLEVariant;
WorkSheet: Variant;
x, y: byte;
Path: variant;
g, r, o: integer;
begin
if bazao then
begin
Path:=ExtractFilePath(Application.ExeName);
SaveExcel.FileName:=baza+'.xls';
if SaveExcel.Execute then
begin
if FileExists(Path+'template.xls') then
begin
CopyFile(Path+'template.xls', SaveExcel.FileName);
Path:=SaveExcel.FileName;
try
XLApp:=CreateOleObject('Excel.Application');
XLApp.Visible:=false;
XLApp.DisplayAlerts:=false;
XLApp.WorkBook.Open(Path+'template.xls');
showmessage(XLApp.Cell[1, 1]);
finally
XLApp.ActiveWorkbook.Save;
XLApp.Quit;
XLApp:=Unassigned;
end;
end
else
Greske.Reinstalacija(Path, 'template.xls');
end;
end
else
begin
if Greske.BazaNijeOtvorena=6 then
otvori_bazu.Execute;
end;
end;
procedure TForm1.napraviekselExecute(Sender: TObject);
var
XLApp: OLEVariant;
WorkSheet: Variant;
x, y: byte;
Path: variant;
g, r, o: integer;
begin
if bazao then
begin
Path:=ExtractFilePath(Application.ExeName);
SaveExcel.FileName:=baza+'.xls';
if SaveExcel.Execute then
begin
if FileExists(Path+'template.xls') then
begin
CopyFile(Path+'template.xls', SaveExcel.FileName);
Path:=SaveExcel.FileName;
try
XLApp:=CreateOleObject('Excel.Application');
XLApp.Visible:=false;
XLApp.DisplayAlerts:=false;
XLApp.WorkBook.Open(Path+'template.xls');
showmessage(XLApp.Cell[1, 1]);
finally
XLApp.ActiveWorkbook.Save;
XLApp.Quit;
XLApp:=Unassigned;
end;
end
else
Greske.Reinstalacija(Path, 'template.xls');
end;
end
else
begin
if Greske.BazaNijeOtvorena=6 then
otvori_bazu.Execute;
end;
end;
Molim vas za pomoc. Unapred hvala.
[Ovu poruku je menjao nekicneko99 dana 06.07.2014. u 19:20 GMT+1]