How To Read From One Excel File And Write To Another
Posted: Tue Jan 01, 2019 2:39 am
Hi
How to read from one Worksheet in one excel file and write to another worksheet in another excel file.
I am not able to write to worksheet S2.
function test
#define xlDouble -4119
LOCAL oExcel := CREATEOBJECT( "Excel.Application" )
LOCAL oSheet
LOCAL oSheet2
subdirc3 = "WK2.xlsx"
oExcel:WorkBooks:Open( "&subdirc3" )
cNamex = "S1"
oExcel:Sheets( cNamex ):Select()
oSheet2 = oExcel:ActiveSheet
subdirc2 = "WK1.xlsx"
oExcel:WorkBooks:Open( "&subdirc2" )
cName = "S1"
oExcel:Sheets( cName ):Select()
oSheet = oExcel:ActiveSheet
excel1 = oSheet2
excel2 = oSheet
excel1:Cells( 30, 5 ):Value=excel2:Cells( 30, 5 ):Value
excel1:Cells( 30, 6 ):Value=excel2:Cells( 30, 6 ):Value
excel1:Cells( 35, 5 ):Value=excel2:Cells( 35, 5 ):Value
excel1:Cells( 35, 6 ):Value=excel2:Cells( 35, 6 ):Value
subdirc3 = "WK2.xlsx"
oExcel:WorkBooks:Open( "&subdirc3" )
cNamex = "S2"
oExcel:Sheets( cNamex ):Select()
oSheet2 = oExcel:ActiveSheet
subdirc2 = "WK1.xlsx"
oExcel:WorkBooks:Open( "&subdirc2" )
cName = "S2"
oExcel:Sheets( cName ):Select()
oSheet = oExcel:ActiveSheet
excel1 = oSheet2
excel2 = oSheet
excel1:Cells( 30, 5 ):Value=excel2:Cells( 30, 5 ):Value
excel1:Cells( 30, 6 ):Value=excel2:Cells( 30, 6 ):Value
Thanks
ACWoo
Using BCC582 + FHW1510
How to read from one Worksheet in one excel file and write to another worksheet in another excel file.
I am not able to write to worksheet S2.
function test
#define xlDouble -4119
LOCAL oExcel := CREATEOBJECT( "Excel.Application" )
LOCAL oSheet
LOCAL oSheet2
subdirc3 = "WK2.xlsx"
oExcel:WorkBooks:Open( "&subdirc3" )
cNamex = "S1"
oExcel:Sheets( cNamex ):Select()
oSheet2 = oExcel:ActiveSheet
subdirc2 = "WK1.xlsx"
oExcel:WorkBooks:Open( "&subdirc2" )
cName = "S1"
oExcel:Sheets( cName ):Select()
oSheet = oExcel:ActiveSheet
excel1 = oSheet2
excel2 = oSheet
excel1:Cells( 30, 5 ):Value=excel2:Cells( 30, 5 ):Value
excel1:Cells( 30, 6 ):Value=excel2:Cells( 30, 6 ):Value
excel1:Cells( 35, 5 ):Value=excel2:Cells( 35, 5 ):Value
excel1:Cells( 35, 6 ):Value=excel2:Cells( 35, 6 ):Value
subdirc3 = "WK2.xlsx"
oExcel:WorkBooks:Open( "&subdirc3" )
cNamex = "S2"
oExcel:Sheets( cNamex ):Select()
oSheet2 = oExcel:ActiveSheet
subdirc2 = "WK1.xlsx"
oExcel:WorkBooks:Open( "&subdirc2" )
cName = "S2"
oExcel:Sheets( cName ):Select()
oSheet = oExcel:ActiveSheet
excel1 = oSheet2
excel2 = oSheet
excel1:Cells( 30, 5 ):Value=excel2:Cells( 30, 5 ):Value
excel1:Cells( 30, 6 ):Value=excel2:Cells( 30, 6 ):Value
Thanks
ACWoo
Using BCC582 + FHW1510