Solved

Cann't open excel file

Posted on 2011-03-25
8
276 Views
Last Modified: 2012-05-11
Cann't open excel file. SOS.
test6comp.xlsx
0
Comment
Question by:zhshqzyc
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 4
  • 3
8 Comments
 

Author Comment

by:zhshqzyc
ID: 35215768
I am using 2007.
0
 
LVL 24

Expert Comment

by:jimyX
ID: 35215772
Change the extension to xls instead of xlsx
0
 

Author Comment

by:zhshqzyc
ID: 35215801
The original file already has xlsx format.
0
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 6

Expert Comment

by:Lordy123
ID: 35215809
Try the attached file.
test6comp.xlsx
0
 
LVL 24

Expert Comment

by:jimyX
ID: 35215814
I suspect that you just changed the extension of the file manually (from xls to xlsx) is it?
If you want to convert Excel files from xls to xlsx then open the original file and then "Save As" and select the new format.
0
 
LVL 24

Expert Comment

by:jimyX
ID: 35215836
I just changed the xlsx to xls and it opened fine.
test6comp.xls
0
 

Author Comment

by:zhshqzyc
ID: 35215905
The origianal file is a xls file, after some processing I save it as xlsx file.
The c# code
 if (saveFileDialog1.ShowDialog() == DialogResult.OK)
                {
                    MessageBox.Show("You selected the file: " + saveFileDialog1.FileName);
                    string sname = saveFileDialog1.FileName;
                    //xlWorkBook.SaveAs(sname, Excel.XlFileFormat.xlWorkbookNormal, misValue, misValue, misValue, misValue, Excel.XlSaveAsAccessMode.xlExclusive, misValue, misValue, misValue, misValue, misValue);
                    xlWorkBook.SaveCopyAs(sname);

Open in new window

How to modify it?
0
 
LVL 24

Accepted Solution

by:
jimyX earned 50 total points
ID: 35216045
If the original file is xls, you can't just save it as xlsx, you need to convert it.
I am not sure what process you do before saving but if you are not sure then just maintain the original extension.
Adjust the filter of the the SaveFileDialog to xls?

You can ask a question about this in the C# zone.
0

Featured Post

On Demand Webinar - Networking for the Cloud Era

This webinar discusses:
-Common barriers companies experience when moving to the cloud
-How SD-WAN changes the way we look at networks
-Best practices customers should employ moving forward with cloud migration
-What happens behind the scenes of SteelConnect’s one-click button

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This code takes an Excel list of URL’s and adds a header titled “URL List”. It then searches through all URL’s in column “A”, looking for duplicates. When a duplicate is found, it is moved to the top of the list. The duplicate URL’s are then highlig…
How to get Spreadsheet Compare 2016 working with the 64 bit version of Office 2016
The viewer will learn how to create a normally distributed random variable in Excel, use a normal distribution to simulate the return on an investment over a period of years, Create a Monte Carlo simulation using a normal random variable, and calcul…
This Micro Tutorial demonstrates using Microsoft Excel pivot tables, how to reverse engineer competitors' marketing strategies through backlinks.

756 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question