Skip to Content
avatar image
Former Member

Error accessing external function select

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.
Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

0 Answers