cancel
Showing results for 
Search instead for 
Did you mean: 

Excel Issue when PB is planned operation

Former Member
0 Kudos

Hi to all,

I've build simple program in PB 12.5.1 (4595)that open an excel file for read some cells.

If I lanuch the application from Windows GUI it's work fine: open the file, read the cells and close the application.

When I perform, via windows planned operation, to execute every day at 23:00 with Administrator credentials, the program can't read the excel cells.

My code is this:

ll_errore = iole_excel.ConnectToObject("excel.application")

if ll_errore <> 0 then

          ll_errore = iole_excel.ConnectToNewObject( "excel.application")

end if

if ll_errore <> 0 then

          is_error = "Si è verificato un errore durante la chiamata a MsExcel."

          return false

end if

if not fileexists(as_file_path) then

          is_error = "File non trovato: " + as_file_path

          return false

end if

iole_excel.Workbooks.Open(is_file_path)

iole_excel.application.visible = false

la_value =  iole_excel.Application.ActiveWorkbook.Worksheets(is_current_sheet).range(as_column + string(al_row) + ":" + as_column + string(al_row)). value

I make a log for debug the application stack and I see the problem is in the last line

iole_excel.Application.ActiveWorkbook.Worksheets(...)

I'm sure that:

1. Excel file is accessibile by program (the open don't show the error message)

2. Excel file is wheel formated and right exenstions (.xlsx (some issue with .xls))

Some ideas for resolve?

TIA

Accepted Solutions (0)

Answers (1)

Answers (1)

Former Member
0 Kudos