on 09-07-2017 12:52 AM - last edited on 02-04-2024 12:33 AM by postmig_api_4
OLEObjectxlApp,xlsub,xls_report,xls_campione
integer li_rc
string ls_filepath = "D:\backup\Temp"
xlApp = Create OLEObject
li_rc = xlApp.ConnectToNewObject( "Excel.Application" )
if li_rc < 0 then
MessageBox("Connect to Excel Failed !",string(li_rc))
Return -1
end if
xlApp.Application.Workbooks.Open(ls_filepath+'\template_rivalutazione_agenti.xls')
xls_report = xlApp.Application.Workbooks[1].Worksheets[1]
xlApp.Application.Workbooks.Open(ls_filepath+'\campioni_rivalutazione_agenti.xls')
xls_campione = xlApp.Application.Workbooks[2].Worksheets[1]
xls_campione.activate()
xls_campione.rows("1:8").copy()
xls_report.activate()
xls_report.Rows("1:8").select()
xls_report.paste()
xlApp.Application.workbooks[1].SaveAs(ls_filepath+"\campioni_rivalutazione_agenti11.xls")
xlApp.Application.WorkBooks.close()
xlApp.Application.WorkBooks.Application.quit()
destroy xlApp
destroy xls_report
destroy xls_campione
This is my script. When working with single excel sheet I am not getting error. But when I execute this script, I am getting select error. Please help.
User | Count |
---|---|
95 | |
11 | |
10 | |
9 | |
9 | |
7 | |
6 | |
5 | |
5 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.