P
pramsjois123
Hello ,
We have a Excel add-in which extends the functionality required for
our product. So we have our own Implementation of Open, Save, Save As.
While opening the Corrupted Excel File, It was throwing an Error which
we solved by using 'XlCorruptLoad.xlRepairFile'
Set currExl =
objExcelApplication.Workbooks.Open(FileName:=strFileName, _
ReadOnly:=bReadOnly,
CorruptLoad:=XlCorruptLoad.xlRepairFile)
But now the problem comes when we want to save this using
objWorkbook.Save method which is throwing Error 1004. Since the
behaviour of Excel application is to Invoke a "Save as" dialog for
Repaired files, we also want to do the same thing. But there is no
property or any other way to know from the Workbook Object that it is
opened in Repair mode (safe mode). If we get to know from the workbook
object whether it is opened in normal mode or repair mode , then we
can call SaveAs instead of Save on the workbook object.
We solved this by having a Custom document property which indicates
whether it is opened using 'XlCorruptLoad.xlNormaLoad' or
'XlCorruptLoad.xlRepairFile'. The property value is set after
objExcelApplication.Workbooks.Open() succeeds.
Now this scenario where we open the workbook using
objExcelApplication.Workbooks.Open() method is somewhat looks solved.
But the problem is in other scenarios we are using CreateProcess to
create the Excel workbook instance. In this case we donot have the
control over opening of the workbook. So we are not able to give a
solution in the scenarios where CreateProcess() is used for Creating
Excel workbook. Please let us know the solution for this.
Also other scenario of failure is, when we are using objApp.Dialogs
(xlDialogOpen).Show() method , This method throws exception when we
open the Corrupted file.
Rgds/Pramoda Jois
We have a Excel add-in which extends the functionality required for
our product. So we have our own Implementation of Open, Save, Save As.
While opening the Corrupted Excel File, It was throwing an Error which
we solved by using 'XlCorruptLoad.xlRepairFile'
Set currExl =
objExcelApplication.Workbooks.Open(FileName:=strFileName, _
ReadOnly:=bReadOnly,
CorruptLoad:=XlCorruptLoad.xlRepairFile)
But now the problem comes when we want to save this using
objWorkbook.Save method which is throwing Error 1004. Since the
behaviour of Excel application is to Invoke a "Save as" dialog for
Repaired files, we also want to do the same thing. But there is no
property or any other way to know from the Workbook Object that it is
opened in Repair mode (safe mode). If we get to know from the workbook
object whether it is opened in normal mode or repair mode , then we
can call SaveAs instead of Save on the workbook object.
We solved this by having a Custom document property which indicates
whether it is opened using 'XlCorruptLoad.xlNormaLoad' or
'XlCorruptLoad.xlRepairFile'. The property value is set after
objExcelApplication.Workbooks.Open() succeeds.
Now this scenario where we open the workbook using
objExcelApplication.Workbooks.Open() method is somewhat looks solved.
But the problem is in other scenarios we are using CreateProcess to
create the Excel workbook instance. In this case we donot have the
control over opening of the workbook. So we are not able to give a
solution in the scenarios where CreateProcess() is used for Creating
Excel workbook. Please let us know the solution for this.
Also other scenario of failure is, when we are using objApp.Dialogs
(xlDialogOpen).Show() method , This method throws exception when we
open the Corrupted file.
Rgds/Pramoda Jois