delphi4arab منتديات دلفي للعرب
خطأ في جلب قيم من الأكسيل - نسخة قابلة للطباعة

+- delphi4arab منتديات دلفي للعرب (https://delphi4arab.net/forum)
+-- قسم : منتديات دلفي للعرب التعليمية (https://delphi4arab.net/forum/forumdisplay.php?fid=3)
+--- قسم : سؤال و جواب حول دلفي (https://delphi4arab.net/forum/forumdisplay.php?fid=15)
+--- الموضوع : خطأ في جلب قيم من الأكسيل (/showthread.php?tid=12410)



خطأ في جلب قيم من الأكسيل - ALG2009 - 08-10-2023

السلام عليكم

هل هذا الخطأ من عدم غلق الأكسيل أو ماذا؟

رسالة الخطأ
OLE error 800Ao033EC

الكود

كود :
uses comobj   private     { Private declarations }         ExcelFile,sheet : Variant; procedure TForm2.Button1Click(Sender: TObject); Var   MaxRow, MaxCol,i,j:Integer; begin    if OpenDialog1.Execute then    ExcelFile := CreateOleObject('Excel.Application');    ExcelFile.visible:=0;    ExcelFile.DisplayAlerts := False;    ExcelFile.Workbooks.Open(OpenDialog1.FileName);    sheet := ExcelFile.WorkSheets[1];    MaxRow := Sheet.Usedrange.Rows.count ;    MaxCol := sheet.Usedrange.Columns.count;    stringgrid1.RowCount:=maxRow+1;    StringGrid1.ColCount:=maxCol+1;    stringgrid1.Cells[1,i]:=excelfile.cells[i,1].value;;    stringgrid1.Cells[2,i]:=excelfile.cells[i,2].value;    stringgrid1.Cells[3,i]:=excelfile.cells[i,3].value;    ExcelFile.workbooks.close;    ExcelFile.quit;    ExcelFile:=Unassigned; end;



RE: خطأ في جلب قيم من الأكسيل - larbiparadox - 09-10-2023

(08-10-2023, 09:31 PM)ALG2009 كتب : السلام عليكم

هل هذا الخطأ من عدم غلق الأكسيل أو ماذا؟

رسالة الخطأ
OLE error 800Ao033EC

الكود

كود :
uses comobj   private     { Private declarations }         ExcelFile,sheet : Variant; procedure TForm2.Button1Click(Sender: TObject); Var   MaxRow, MaxCol,i,j:Integer; begin    if OpenDialog1.Execute then    ExcelFile := CreateOleObject('Excel.Application');    ExcelFile.visible:=0;    ExcelFile.DisplayAlerts := False;    ExcelFile.Workbooks.Open(OpenDialog1.FileName);    sheet := ExcelFile.WorkSheets[1];    MaxRow := Sheet.Usedrange.Rows.count ;    MaxCol := sheet.Usedrange.Columns.count;    stringgrid1.RowCount:=maxRow+1;    StringGrid1.ColCount:=maxCol+1;    stringgrid1.Cells[1,i]:=excelfile.cells[i,1].value;;    stringgrid1.Cells[2,i]:=excelfile.cells[i,2].value;    stringgrid1.Cells[3,i]:=excelfile.cells[i,3].value;    ExcelFile.workbooks.close;    ExcelFile.quit;    ExcelFile:=Unassigned; end;

كود :
procedure TForm1.Button1Click(Sender: TObject); Var   MaxRow, MaxCol,i,j:Integer; begin   if OpenDialog1.Execute then   ExcelFile := CreateOleObject('Excel.Application');   ExcelFile.visible:=0;   ExcelFile.DisplayAlerts := False;   ExcelFile.Workbooks.Open(OpenDialog1.FileName);   sheet := ExcelFile.WorkSheets[1];   MaxRow := Sheet.Usedrange.Rows.count ;   MaxCol := sheet.Usedrange.Columns.count;   stringgrid1.RowCount:=maxRow+1;   StringGrid1.ColCount:=maxCol+1;     For i := 1 to (maxRow+1) do begin     stringgrid1.Cells[1,i]:=excelfile.cells[i,1].value;;     stringgrid1.Cells[2,i]:=excelfile.cells[i,2].value;     stringgrid1.Cells[3,i]:=excelfile.cells[i,3].value;     end;   ExcelFile.workbooks.close;   ExcelFile.quit;   ExcelFile:=Unassigned; end;



RE: خطأ في جلب قيم من الأكسيل - ALG2009 - 09-10-2023

جزاكم الله خير
لقد نُفذ دون أخطاء بارك الله فيك