vfp控制excel,将a.xls中sheet1第C列粘贴到b.xls中sheet1第C列
vfp控制excel,将a.xls中sheet1第C列粘贴到b.xls中sheet1第C列(从第三行开始的所有行,行数不定)(我用vfp处理excel数据后结果不会写回原表,最后只好手工粘贴)
ACopyToB("D:\a.xls","D:\b.xls") *!*--------------------- FUNCTION ACopyToB( tcFileSource as String ,tcFileDestination as String ) LOCAL oExcel AS "excel.application" LOCAL nDataRows as Integer oExcel=Createobject('Excel.application') oExcel.DisplayAlerts=.f. oExcel.Workbooks.Open(tcFileSource) &&打开源文件 nDataRows=oExcel.SHEETS(1).UsedRange.Rows.Count &&有数据的总行数 cRange=["C3:C]+TRANSFORM(nDataRows)+["] oExcel.range(&cRange).select &&选中数据 oExcel.Selection.Copy oExcel.Workbooks.Close &&关闭源表 *!* oExcel.Visible=.T. oExcel.Workbooks.Open(tcFileDestination) &&打开目标文件 oExcel.Worksheets("sheet1").Activate oExcel.Range("C3").PasteSpecial(-4104) oExcel.ActiveWorkbook.Save *oExcel.Workbooks.Close *oExcel.Quit Release oExcel