clear
lcsys16 = Sys(16)
lcprogram = Substr(lcsys16, At(":", lcsys16) - 1)
sys_maindir=Left(lcprogram, Rat("\", lcprogram))
Set Default To (sys_maindir)
Select 1
Use sys_maindir+"sz000001_成交明细_2011-01-04.Dbf"
lcFileName="sz000045_成交明细_2011-01-04.xls"
oExcel=Createobject('Excel.application')
oExcel.Workbooks.Open('&lcFileName') &&打开文件
Rs=oExcel.SHEETS(1).UsedRange.Rows.Count &&有数据的总行数
Cs=oExcel.SHEETS(1).UsedRange.Columns.Count &&有数据的总列数
oExcel.ActiveSheet.UsedRange.Select
&&已用的区域
oExcel.Selection.NumberFormatlocal="h:mm:ss"
oExcel.ActiveWorkbook.SaveAs("J2.xls")
oExcel.ActiveWorkbook.saved=.T. &&不保存当前EXCEL表
oExcel.Workbooks.Close &&关闭表
lcFileName="J2.xls"
oExcel.Workbooks.Open('&lcFileName')
If Rs>=2 Then
&&oExcel.activesheet.columns(1).select
&&oExcel.Selection.NumberFormatLocal="HH:MM:SS" &&设置单元格属性
For i=2 To 10
sys_date=oExcel.Cells(i,1).Value
*Append Blank
?sys_date
Wait Windows sys_date Nowait
*Replace 成交时间 With sys_date
Endfor
Endif
oExcel.DisplayAlerts=.F.
oExcel.ActiveWorkbook.saved=.T. &&不保存当前EXCEL表
oExcel.Workbooks.Close &&关闭表
oExcel.Quit &&退出EXCEL
Release oExcel &&释放变量
RETURN