打印本文 打印本文 关闭窗口 关闭窗口
把vfp表中的数据导入指定的excel文件中
作者:武汉SEO闵涛  文章来源:敏韬网  点击数990  更新时间:2009/4/22 23:21:12  文章录入:mintao  责任编辑:mintao

 


select cb_zwhz
go top
XLApp = GetObject('F:\temp\sqlinout.xls','excel.sheet')
XLApp.application.visible=.F.
XLApp.application. Windows("sqlinout.xls").Visible = .T.
XLSheet =XLApp.Sheets['Sheet1']
XLSheet.Cells(1,1).Value = "Month"
XLSheet.Cells(1,2).Value = "ZwCode"
XLSheet.Cells(1,3).Value = "Qty"
XLSheet.Cells(1,4).Value = "Cost"
XLSheet.Cells(1,5).Value = "Money"

i=1
select cb_zwhz
do while not eof ()
  XLSheet.Cells(i+1,1).Value=Month
  XLSheet.Cells(i+1,2).Value=ZwCode
  XLSheet.Cells(i+1,3).Value=Qty
  XLSheet.Cells(i+1,4).Value=Cost
  XLSheet.Cells(i+1,5).Value=Money
  skip
  i=i+1
enddo 
XLApp.Save
XlApp.Close

关闭本页  

打印本文 打印本文 关闭窗口 关闭窗口