Solved

Classic ASP, Microsoft Excel 2007

Posted on 2011-03-03
8
2,948 Views
Last Modified: 2012-05-11
Hi, I am writing a script to export data to an excel file which works
fine but it gives me warning:

"The file you are trying to open, 'ABC.xls', is in a different format than specified by the file extension. Verify that the file is not corrupted and is from a trusted source before opening. Do you want to open file now?"

If I use the extension .xlsx, the file will get created, but Excel won't let me
open it. I get an error:
"Excel cannot open the file "ABC.xlsx"
because the file format or file extension is not valid. Verify that
the file has not been corrupted and that the file extension matches
the format of the file".

With .xls, I can open file with warning and with .xlsx, I can't open the file.
It'll be really helpful if you help me get rid of that warning.

I am using classic ASP and Microsoft Office 2007.


Thank you.



0
Comment
Question by:pawar_deepak
8 Comments
 
LVL 28

Expert Comment

by:sammySeltzer
ID: 35031517
I *think* you can find a solution from this link:

http://www.eggheadcafe.com/community/aspnet/2/10051034/problem-when-opening-a-excel-file-wrtten-using-c-net-code.aspx

Please let me know if none of the solutions help you.
0
 
LVL 7

Expert Comment

by:hippohood
ID: 35041012
Hi

It is not clear to me if you are getting this error when script tries open the file or or when you are trying to open an Excel file created by script?

without seen what your script is doing it is difficult to say, but, apparenty, your script assumes a wrong file formats/types. XLS extension is used for 97-2003 workbboks versions.

For 2007+ version they have several types for this: XLSX is for no-macro workbooks (which are, in reality, a XML text file compressed with ZIP), XLSM is a macro-enabled workbook and XLSB is a binary file, most similar to XLS.

Most likely, your file should has XLSM extension, and the Excel warns you that you are opening a file, which may be hazardous. Try using XLSM extension and add the file location to Trusted Sources.
0
 
LVL 14

Accepted Solution

by:
Zack Barresse earned 500 total points
ID: 35053916
When you create the file, are you using the new file format extensions?  Take a look at Ron de Bruin's site for examples on saving 2007+ files...

http://www.rondebruin.nl/saveas.htm

Zack
0
Highfive + Dolby Voice = No More Audio Complaints!

Poor audio quality is one of the top reasons people don’t use video conferencing. Get the crispest, clearest audio powered by Dolby Voice in every meeting. Highfive and Dolby Voice deliver the best video conferencing and audio experience for every meeting and every room.

 
LVL 14

Expert Comment

by:Zack Barresse
ID: 35318053
It seems it's another file format issue, which should be resolved if they specify the particular file format in their code.  The link to Ron de Bruin's site has it well documented, and should have worked for them.  I don't care about the points, but I disagree that it should be deleted as I've provided the solution.

Zack
0
 
LVL 28

Expert Comment

by:sammySeltzer
ID: 35318823
I too could care less about the points but what gets me with the recommendation is that the poster never actually responded to any of the solutions posted.

So, I am not real sure why the decision to delete.

Either way, refund him his points but please encourage them to respond to solutions so we know whether or not the solutions we suggest has helped them or not.
0
 
LVL 1

Expert Comment

by:modus_operandi
ID: 35357068
Starting auto-close process to implement the recommendations of the participating Expert(s).
 
modus_operandi
EE Admin
0

Featured Post

Highfive Gives IT Their Time Back

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

Introduction This Article is a follow-up to my Mappit! Addin Article (http://www.experts-exchange.com/A_2613.html), it was inspired by an email posting I made to EUSPRIG (http://www.eusprig.org/index.htm), I will briefly cover: 1) An overvie…
This tutorial explains how to create a series of drop-down lists that are dependent upon prior selections to guide (“force”) the user to make the correct selection and reduce data errors within Microsoft Excel. Excel 2010 was used for this tutorial;…
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…
Graphs within dashboards are meant to be dynamic, representing data from a period of time that will change each time the dashboard is updated with new data. Rather than update each graph to point to a different set within a static set of data, t…

758 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

Need Help in Real-Time?

Connect with top rated Experts

13 Experts available now in Live!

Get 1:1 Help Now