473,406 Members | 2,281 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,406 software developers and data experts.

Problem Opening an Corrupted Excel file

Hi,
I am trying to open an existing excel workbook. It pops up an error
stating that
“Errors were detected in 1598.xls but Microsoft Office Excel was able to
open the file by making the repairs listed below. Save the file to make these
repairs permanent.” ‘Renamed invalid sheet name.’“

This message is popped up when the XLS file has work sheet with the name
like rpt:coursedetails etc.,

When trying to open this workbook, programmatically in VB.Net, the following
exception is raised:

An unhandled exception of type 'System.Runtime.InteropServices.COMException'
occurred in ExcelObjetCreation.exe

Additional information: Exception from HRESULT: 0x800A03EC.

Could you please tell me how this exception can be handled?

DO THERE IS ANY WAY

The code that i have written to open a currepted file is as below

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Button1.Click
Dim xlApp As New Excel.Application
Dim xlworkBook As Workbook
Dim xlSheet As Worksheet
Dim ExcelFile_Path As String = "C:\XLReports\913.xls"
xlApp = CreateObject("Excel.Application")
xlSheet = xlApp.ActiveSheet()
MsgBox(xlSheet.Name)
xlworkBook = xlApp.Workbooks.Open(ExcelFile_Path)
MsgBox(xlworkBook.Name)
xlSheet = xlworkBook.Sheets(1)
MsgBox(xlSheet.Name)
xlSheet.Name = "Mysheet"
MsgBox(xlSheet.Name)

End Sub

I get an error at the following code
xlworkBook = xlApp.Workbooks.Open(ExcelFile_Path)
I feel like that its not possible to open a workbook which has a corrupted
sheetname.
How do microsoft open such file and ask for renaming it,and rename it?

Dec 6 '05 #1
1 4365
You can use this to open a correpted report and rename it.
Case "EXCEL"

strFullPath = strSpoolPath & strReportID & ".xls"

strOutputFormat = Constants.acFormatXLS

If InStr(strRepName, ":") Then

Dim strNewRepName As String

strNewRepName = Replace(strRepName, ":", "_")

objAcc.DoCmd.CopyObject(, strNewRepName,
AcObjectType.acReport, strRepName)
objAcc.DoCmd.OutputTo(AcOutputObjectType.acOutputR eport, strNewRepName,
Constants.acFormatXLS, strFullPath, False)

objAcc.DoCmd.DeleteObject(AcObjectType.acReport,
strNewRepName)

Else
objAcc.DoCmd.OutputTo(AcOutputObjectType.acOutputR eport, strRepName,
Constants.acFormatXLS, strFullPath, False)

End If

strFilename = strReportID & ".xls"
"Boomessh" wrote:
Hi,
I am trying to open an existing excel workbook. It pops up an error
stating that
“Errors were detected in 1598.xls but Microsoft Office Excel was able to
open the file by making the repairs listed below. Save the file to make these
repairs permanent.” ‘Renamed invalid sheet name.’“

This message is popped up when the XLS file has work sheet with the name
like rpt:coursedetails etc.,

When trying to open this workbook, programmatically in VB.Net, the following
exception is raised:

An unhandled exception of type 'System.Runtime.InteropServices.COMException'
occurred in ExcelObjetCreation.exe

Additional information: Exception from HRESULT: 0x800A03EC.

Could you please tell me how this exception can be handled?

DO THERE IS ANY WAY

The code that i have written to open a currepted file is as below

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Button1.Click
Dim xlApp As New Excel.Application
Dim xlworkBook As Workbook
Dim xlSheet As Worksheet
Dim ExcelFile_Path As String = "C:\XLReports\913.xls"
xlApp = CreateObject("Excel.Application")
xlSheet = xlApp.ActiveSheet()
MsgBox(xlSheet.Name)
xlworkBook = xlApp.Workbooks.Open(ExcelFile_Path)
MsgBox(xlworkBook.Name)
xlSheet = xlworkBook.Sheets(1)
MsgBox(xlSheet.Name)
xlSheet.Name = "Mysheet"
MsgBox(xlSheet.Name)

End Sub

I get an error at the following code
xlworkBook = xlApp.Workbooks.Open(ExcelFile_Path)
I feel like that its not possible to open a workbook which has a corrupted
sheetname.
How do microsoft open such file and ask for renaming it,and rename it?

Dec 9 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: Oci-One Kanubi | last post by:
Everything works fine in Access, but when I double-click on the resultant Excel files the first one opens correctly, but subsequent ones, and any other Excel files I try to open, fail to display at...
4
by: Trond A. S. Andersen | last post by:
Hi, all! I'm trying to use the System.Web.Mail. "package" combinded with System.Web.Mail.SmtpMail in order to send MS Excel spreadsheets attached to mail messages. However, sending one single...
2
by: Steve Chatham | last post by:
I use the following code: Private Sub RbtnExport_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles RbtnExport.SelectedIndexChanged Dim sFile As String =...
2
by: Mad Scientist Jr | last post by:
>From an asp.net web page I want the user to open the results of a SQL query in Excel, as automatically as possible (ie not having to loop through columns, rows, in code). For this,...
0
by: Muhammad Zeeshan Iqbal | last post by:
Hello, Language= Java; Platform= Linux; Application= Web I have help excel file. I download it using FileInputStream. When it is downloaded from solaris or widows platform it is correct....
20
by: ongaro.admin | last post by:
Hi, I'm experiencing a strange problem with .mdb files. We have two buildings connected by optical fiber (a single LAN). Everything works perfect with any file, any size, any application...
16
by: Phil Stanton | last post by:
I have a form with a button which is supposed to open an Excel file (With lots of Macros /VBA) in it. The Excel file gets it's data from the Access program Here is the code Private Sub...
0
by: shyshack | last post by:
Hi, I am quite new in C#. I am writing an application in which I have to open Excel file to import data from it. When opening small files everything works ok - the problem appears when I try to...
1
navanova
by: navanova | last post by:
Greetings, I have a problem of opening ms word and excel files on my computer. The files are there for a long time. I use to open and modify them. Suddenly, when i try to open the word files, a...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development projectplanning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.