Solved

Classic ASP, Microsoft Excel 2007

Posted on 2011-03-03
8
3,038 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
[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
8 Comments
 
LVL 29

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
Online Training Solution

Drastically shorten your training time with WalkMe's advanced online training solution that Guides your trainees to action. Forget about retraining and skyrocket knowledge retention rates.

 
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 29

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

Online Training Solution

Drastically shorten your training time with WalkMe's advanced online training solution that Guides your trainees to action. Forget about retraining and skyrocket knowledge retention rates.

Question has a verified solution.

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

Introduction While answering a recent question (http:/Q_27311462.html), I created an alternative function to the Excel Concatenate() function that you might find useful.  I tested several solutions and share the results in this article as well as t…
Some code to ensure data integrity when using macros within Excel. Also included code that helps secure your data within an Excel workbook.
This Micro Tutorial demonstrates using Microsoft Excel pivot tables, how to reverse engineer competitors' marketing strategies through backlinks.
This Micro Tutorial will demonstrate in Microsoft Excel how to add style and sexy appeal to horizontal bar charts.

732 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