我想把编缉栏里的数据﹐如edit1.text 里的内容﹐导出到excel里﹐我用了好几种方法﹐却都是错的﹐
如 Procedure editToExcel(ExcelCaption:String;);
var
 ExcelApp:OleVariant;
 begin
 ExcelApp := CreateOleObject('Excel.Application');
 ExcelApp.Caption := ExcelCaption;
 ExcelApp.WorkBooks.Add;
 ExcelApp.WorkSheets[1].Activate;
 ExcelApp.Visible := True;
   ExcelApp.Cells[1,1].Value := edit1.text
   ExcelApp.Cells[1,2].Value := edit2.text.......
 end;
end;
各位大哥﹐小姐﹐帮我呀~~在下不胜感激

解决方案 »

  1.   

    没有保存这个excel 文件吧?
      

  2.   

    iuprg(蒼狼)﹐你的意思是﹐是在指定的路徑里﹐建立excel文件然后保存還是在程式里﹐建立一條﹐edit......post語句﹖﹖﹖
      

  3.   

    xlapp:variant;
    xlworkbook:varinat;
    xlworksheet:variant; xlapp:=CreateOleObject('Excel.application');
        XlApp.Visible:=False;
        xlWorkBook:=xlApp.Workbooks.Add(-4167);
        xlWorkSheet:=xlapp.WorkBooks[1].Worksheets['sheet1']
    xlWorkSheet.cells[1,1]:=edit1.text;
    xlapp.visisble:=True;
      

  4.   

    to   yesxwl(吳宮幽徑)
    我于你的寫法﹐
    出現如下錯誤提示~~
    method visisble' not supported by automation object
     
    請問還要加什么控制對像嗎﹖
      

  5.   

    uses comobjxlapp:=CreateOleObject('Excel.application');
        XlApp.Visible:=False;
      

  6.   

    另外查看下是不是visible写成了visible'