Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2
Default VBA - Corrupt Excel Load

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:=strFi leName, _
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
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 9,101
Default VBA - Corrupt Excel Load

When you open the repair file what is the window name in excel (should be
same as name of workbook)?

check the string currexl.name using Instr()

" wrote:

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:=strFi leName, _
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

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2
Default VBA - Corrupt Excel Load

On Apr 7, 6:06*pm, joel wrote:
When you open the repair file what is the window name in excel (should be
same as name of workbook)?

check the string currexl.name using Instr()



" wrote:
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:=strFi leName, _
* * * * * * * * * * * * 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- Hide quoted text -


- Show quoted text -


Hi Joel,
I will check this. So you mean if the window name is not same as
Workbook name, we assume that the Excel is opened in repair mode?


Rgds/Pramoda Jois
  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 9,101
Default VBA - Corrupt Excel Load

When you create a new workbook in excel it doesn't have the XLS at the end.
Only when the file is saved does the xls appear. I don't have a corrupt
workbook to run a test. Not sure how to create one. but I remember seeing a
difference in the window name indicating an error has occured.

" wrote:

On Apr 7, 6:06 pm, joel wrote:
When you open the repair file what is the window name in excel (should be
same as name of workbook)?

check the string currexl.name using Instr()



" wrote:
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:=strFi leName, _
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- Hide quoted text -


- Show quoted text -


Hi Joel,
I will check this. So you mean if the window name is not same as
Workbook name, we assume that the Excel is opened in repair mode?


Rgds/Pramoda Jois

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Excel Corrupt File Znarf Excel Discussion (Misc queries) 3 July 7th 11 07:11 AM
Corrupt Excel File? Alan Excel Programming 0 November 15th 06 01:21 AM
Corrupt Excel File Hervinder Excel Discussion (Misc queries) 1 June 13th 06 01:09 PM
Corrupt Excel File Stephanie Colasurdo Excel Programming 1 January 6th 06 11:19 PM
is my excel corrupt? VLOOKUP Vass Excel Discussion (Misc queries) 2 July 28th 05 11:22 AM


All times are GMT +1. The time now is 10:18 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"