473,796 Members | 2,559 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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:coursedetai ls etc.,

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

An unhandled exception of type 'System.Runtime .InteropService s.COMException'
occurred in ExcelObjetCreat ion.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(B yVal sender As System.Object, ByVal e As
System.EventArg s) Handles Button1.Click
Dim xlApp As New Excel.Applicati on
Dim xlworkBook As Workbook
Dim xlSheet As Worksheet
Dim ExcelFile_Path As String = "C:\XLReports\9 13.xls"
xlApp = CreateObject("E xcel.Applicatio n")
xlSheet = xlApp.ActiveShe et()
MsgBox(xlSheet. Name)
xlworkBook = xlApp.Workbooks .Open(ExcelFile _Path)
MsgBox(xlworkBo ok.Name)
xlSheet = xlworkBook.Shee ts(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 4391
You can use this to open a correpted report and rename it.
Case "EXCEL"

strFullPath = strSpoolPath & strReportID & ".xls"

strOutputFormat = Constants.acFor matXLS

If InStr(strRepNam e, ":") Then

Dim strNewRepName As String

strNewRepName = Replace(strRepN ame, ":", "_")

objAcc.DoCmd.Co pyObject(, strNewRepName,
AcObjectType.ac Report, strRepName)
objAcc.DoCmd.Ou tputTo(AcOutput ObjectType.acOu tputReport, strNewRepName,
Constants.acFor matXLS, strFullPath, False)

objAcc.DoCmd.De leteObject(AcOb jectType.acRepo rt,
strNewRepName)

Else
objAcc.DoCmd.Ou tputTo(AcOutput ObjectType.acOu tputReport, strRepName,
Constants.acFor matXLS, 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:coursedetai ls etc.,

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

An unhandled exception of type 'System.Runtime .InteropService s.COMException'
occurred in ExcelObjetCreat ion.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(B yVal sender As System.Object, ByVal e As
System.EventArg s) Handles Button1.Click
Dim xlApp As New Excel.Applicati on
Dim xlworkBook As Workbook
Dim xlSheet As Worksheet
Dim ExcelFile_Path As String = "C:\XLReports\9 13.xls"
xlApp = CreateObject("E xcel.Applicatio n")
xlSheet = xlApp.ActiveShe et()
MsgBox(xlSheet. Name)
xlworkBook = xlApp.Workbooks .Open(ExcelFile _Path)
MsgBox(xlworkBo ok.Name)
xlSheet = xlworkBook.Shee ts(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
2482
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 all; I get the Excel window frame with corrupted contents. The only way I can get decent functionality from Excel is to open Excel from the Start menu, open each of these new files from the Excel File menu, and save each one. Thereafter Excel...
4
8675
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 spreadsheet attachment per message, seems to be causing som kind of corruption of the attachment, while several spreadsheets per works just fine. Consider the following three snippets of C# code:
2
2480
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 = Session("User") & "-Customer List-" & Today() sFile = sFile.Replace("/", "") RbtnExport.Visible = False Select Case RbtnExport.SelectedItem.Value Case "Excel" Response.ContentType = "application/x-msexcel"
2
3124
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, dataset.writexml works great (got the code from http://forums.devx.com/archive/index.php/t-57273.html ) The only question I have is, when Excel opens up, it isn't the view I would prefer. It opens as a read-only workbook, I would prefer as an
0
1285
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. But when it is downloaded from Linum platform it becomes corrupted.
20
2172
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 software. The hardware has been tested several times. Viruses, trojans and so on: clean for sure. The problem is that .mdb files (_only .mdb files_) often don't open, are very slow, or even get crashed and corrupted. The weird is that even copying them...
16
5192
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 Storage_Click() On Error GoTo Err_Storage_Click
0
1341
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 open larger one (14 MB) - the excel stops working while doing it. I tried to cope with it by changing last parameter in xlApp.Workbooks.Open() function to xlExtractData. Excel opens file and everything seems to work fine, but an annoyinig warning...
1
2444
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 dialog box appears that says "There was an error opening the file". when i try to open the excel files, a dialog box appears that says "File format not valid". I have tried to create a new word and excel files, save them and when i try to open these...
0
9673
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, well explore What is ONU, What Is Router, ONU & Routers main usage, and What is the difference between ONU and Router. Lets take a closer look ! Part I. Meaning of...
0
9525
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10452
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10221
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10169
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
5440
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5569
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
3730
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2924
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.