Radley1303
New Member
Progress 9.1E Appserver
Hi All,
I have an automated program that takes MS Excel XLS files as input, reads the data from the XLS and populates some db tables. The problem I am having is that some of the XLS files are password protected (they are supplied via an external source) - in this instance I just want to flag up to a log file that they can't be read.
<code snippet>
CREATE "Excel.Application" chExcelApp.
chExcelApp:VISIBLE = NO.
chWorkbook = chExcelApp:Workbooks:OPEN(pi_cImportFile) NO-ERROR.
IF ERROR-STATUS:ERROR THEN
[send error to log file etc]
ELSE chWorkSheet = chExcelApp:Sheets:ITEM(1).
</code snippet>
The NO-ERROR isn't working as Excel pops up prompting for a password. If I don't enter a valid password I get 'Error Occurred while accessing component property/method : Sheets' etc. Is there anyway before I do the OPEN that I can check if the XLS is protected ? Something like :
IF chExcelApp:WorkbooksROTECTED(pi_cImportFile) THEN... ???
As always, thanks in advance.
Hi All,
I have an automated program that takes MS Excel XLS files as input, reads the data from the XLS and populates some db tables. The problem I am having is that some of the XLS files are password protected (they are supplied via an external source) - in this instance I just want to flag up to a log file that they can't be read.
<code snippet>
CREATE "Excel.Application" chExcelApp.
chExcelApp:VISIBLE = NO.
chWorkbook = chExcelApp:Workbooks:OPEN(pi_cImportFile) NO-ERROR.
IF ERROR-STATUS:ERROR THEN
[send error to log file etc]
ELSE chWorkSheet = chExcelApp:Sheets:ITEM(1).
</code snippet>
The NO-ERROR isn't working as Excel pops up prompting for a password. If I don't enter a valid password I get 'Error Occurred while accessing component property/method : Sheets' etc. Is there anyway before I do the OPEN that I can check if the XLS is protected ? Something like :
IF chExcelApp:WorkbooksROTECTED(pi_cImportFile) THEN... ???
As always, thanks in advance.