.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
Sign In
Win Surprise Gifts!!!

Top 5 Contributors of the Month
Gaurav Pal
Post New Web Links

Excel Interop Save as

Posted By:      Posted Date: August 21, 2010    Points: 0   Category :ASP.Net


I want to Save excel workbook using Excel interop in 97-2003 format. Currently I have Office 2007 installed on my machine.

below is the code I am using.

_book.SaveAs("New.xls", Excel.XlFileFormat.xlWorkbookDefault, Missing.Value, Missing.Value, false, false, Excel.XlSaveAsAccessMode.xlNoChange, Missing.Value, Missing.Value, Missing.Value, Missing.Value, Missing.Value);

The solution is little urgent.


View Complete Post

More Related Resource Links

Microsoft Office Excel cannot open or save any more documents because there is not enough available


hi all,

     i am new to asp.net programming i am trying to create an ms excel file with charts drawn in it,

i wrote the complete code for it but the it is saying

Microsoft Office Excel cannot open or save any more documents because there is not enough available memory or disk space. 

i have set the permissions to my complete disk space and all user accounts, and i tried with anti-virus disabling also it didnt work please try to help me out and my code is :

Imports System.Data.OleDb
Imports Microsoft.Office.Interop
Imports Microsoft.Office.Tools.Excel
Imports System

System.Runtime.InteropServices.COMException (0x800A03EC): Microsoft Excel cannot open or save any mo


Hello good people, 

I have this beast as an error. Did my research and found some posts here as well but did not do any good for me. 

Here is what I did. I had an error regarding issue rights with COM objects so I gave access rights under component services for Microsoft Excel application now I am getting this error. 

Here is some information regarding this

1. Gave rights to ASPNET and network service to my web app directory to try to fix this error. 

2. The exact same process works on my Windows 2003 server and my Windows 7 development machine. I am trying to get this going on a different windows 2003 machine that is outside of our domain.

3. Developing on windows 7 64 bit with office 2010 installed. Also excel 2010 is installed on my Web server

4. Here is the code that is causing the error: The last line is causing the error.:

            MyXl = new Microsoft.Office.Interop.Excel.Application();
            MyXl.Visible = false;
            MyWb = (Microsoft.Office.Interop.Excel._Workbook)(MyXl.Workbooks.Add(Missing.Value));
            int test = 0; 
            MySheet = (Microsoft.Office.Interop.Excel._Worksheet)MyXl.ActiveSheet;
            if (reader.HasRows)
                int InRow = 2; 
                for (int i = 0; i < Nu

Save excel in .xslx format using c#



My existing code converting xml in to excel and it is saving excel in .xls format.

But i need to save it in .xlsx format .

Existing code for converting xml...

XmlDataDocument xmlDataDoc = new XmlDataDocument();
            XslCompiledTransform xslTransform = new XslCompiledTransform();
            // Generate Excel Report
            using (XmlTextWriter xmlWriter = new XmlTextWriter(outputFileAndPath, System.Text.Encoding.UTF8))
                xmlWriter.Formatting = Formatting.Indented;
                xmlWriter.Indentation = 3;

Read Excel sheet by Sheet Name using office interop

Hi,I am using office interop to read Excel sheet.I want to read the contents of the sheet  using the name of the sheet.For example I want to read the contents of the sheet- "ABC" (if ABC exists).Thanks

Would like to use an Excel file on the net then save changes

I have an excel sheet that i would like to use on the net. I can convert it using spreadsheetconverter but it will not save the changes as it converts it to an htm file.  But works (limited functions though, it wont convert sliders) Can I use VWD somehow so it reads the excel file and then if I make changes, to save them to the file. So when I view it again no the net it sees the changes?? Goal is the use the excel file on the net without having to have it on someones computer I just started VWD  

Client (Excel) crashes on exit with C# Interop Server (in-proc)

Hello, I'm having a generic problem understanding how to free resources when writing .net COM Servers (using CCW). Excel 2007 VBA is my client in this case. I believe it to be a problem that resources aren't immediately freed and on exit of Excel, a crash occurs which is probably due to invalid resources. The code server code I have is as follows: using System; using System.Collections.Generic; using System.Text; using System.Runtime.InteropServices; using System.Windows.Forms; using System.Threading; using System.Diagnostics; namespace myclass { [Guid("84F0D8F6-AF73-43fe-92D3-C7264EDBDB18")] [ComVisible(true)] public interface IProgress { [DispId(1)] void Show(); [DispId(7)] void Finished(bool WaitOnOk); } [Guid("1195C591-8592-4533-BFFD-C383B33B2976"), InterfaceType(ComInterfaceType.InterfaceIsIDispatch)] [ComVisible(true)] public interface IProgressEvents { } [Guid("9773AD88-E17C-4c27-94AE-BA3FC330F162"), ClassInterface(ClassInterfaceType.None), ComSourceInterfaces(typeof(IProgressEvents))] [ComVisible(true)] public class Progress : IProgress { System.Diagnostics.BooleanSwitch trace = null; System.IO.FileStream log = null; private bool m_InitForm = false; public Progress() { log = System.IO.File.Create(@"c:\hbasElvis.txt"); Trace.Listeners.A

** Microsoft.Office.Interop.Excel.dll - Do I need Excel installed?? **

Hi,I have a VB.Net app which creates an Excel report.  This is all working fine on my development boxwhich turns out to have MS Office 2003 installed.  The app works fine.  I added a reference toMicrosoft Excel 11.0 Object Library under the COM tab when I did the "Add Reference".  I also copiedthe Interop.Excel.dll to my BIN folder.The server that I need to deploy my app to does not have MS Office or Excel installed.  I ran the appanyway just to see if it would worked.  Of course, it failed with this error:Retrieving the COM class factory for component with CLSID {00020820-0000-0000-C000-000000000046} failed due to the following error: 80040154.Do I need to have Excel installed on the target machine?  I took a copy of "Microsoft.Office.Interop.Excel.dll"from the GAC on the DEV box and installed on the GAC on the target machine.  Tried the app again and stillfailed with the same error.  I really don't want to install Excel if I don't have to.  Can someone please providesome help on this?Thank you in advance!

Can't find Microsoft.Office.Interop.Excel.dll



I am trying to use this namespace and downloaded the O2003pia.exe from http://support.microsoft.com/kb/897646.


I ran the msi and see the Interop files in the GAC but when I try to 'Add a Reference' in VS2005, I do not see any of the Interop namespaces.


I already had Office 2003 installed before I ran the above msi.


What else am I doing wrong. Why aren't these included with VS2005 in the first place..............


Please help,



ASP.NET Excel Microsoft.Office.Interop.Excel.ApplicationClass



My server is windows 2008 R2. Everything is running well except the following.

Whenever I tried to export to excel using:

Microsoft.Office.Interop.Excel.ApplicationClass app = new Microsoft.Office.Interop.Excel.ApplicationClass();

It shows exception:

Retrieving the COM class factory for component with CLSID {00024500-0000-0000-C000-000000000046} failed due to the following error: 80070005

I searched on google, almost every suggestion told me to find Microsoft Excel Application in DomConfig. But I found no Microsoft Excel in DomConfig. Please note, I have Excel 2003 & 2007 on that server.

Please help me, its really urgent.

Microsoft.Office.Interop.Excel NumberFormmatting Help


Hi Everyone. I wasn't sure which forum to put this under, so please move if necessary.


I have an app that exports a data table to excel. This works, however, i have a column with currency that i can't get formatted properly.


IE: Right now it prints 24450.00 or 24000 if a whole number with no decimal places.


I have tried a lot of things, but this is what i have right now for my range and formatting. Below is a copy of the method. Please let me know where i am going wrong, because with this range and formatting, SOME of the numbers are showing up #######.


Below is my formatting code. What am i missing? It seems like it formats some based on the "$#,##0.00", but it doesn't work for them all.

How do i set everything to "Currency" like in the excel options? I have tried range.NumberFormat = "Currency" but that is invalid. Any help is appreciated.

 Microsoft.Office.Interop.Excel._Application excel = new Microsoft.Office.Interop.Excel.ApplicationClass();
      Microsoft.Office.Interop.Excel.Workbook wb = (Microsoft.Office.Interop.Excel.Workbook)excel.Workbooks.Add(System.Reflection.Missing.Value);
      Microsoft.Office.Interop.Excel.Worksheet ws = (Microsoft.Office.In

Unable to save Excel files opened from SharePoint

Hi all!

From time to time users have problem saving excel files that they have opened from a SharePoint document library.

Error message:

"Document could not be saved"

It's not possible to save it localy ither.

Any ideas?


Microsoft.Office.Interop.Excel on Server


Good day,

I got the srcipt working on my Local PC.
But when importing on to server, i get the error.

"Could not load file or assembly 'Microsoft.Office.Interop.Excel, Version=10.0.4504.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies. The system cannot find the file specified."

I copied the files & registered to all locations i have on my local PC.

But the the server does not have the  Visual Studio .NET Command Prompt - not sure if it is needed as I use the register.bat


Microsoft.Office.Interop.Excel, Version= issue


Hello Friends,

I just got a new computer. Running VS2008 professional with MS Office 2010 on a Win 7 64-bit machine... 

I am using the Excel in my Web Site (NOTE: It is not a Web App so I do not have a csproj file in there) 

I am getting this error on my Windows 2003 Web servers (I have 2 of them): 

Could not load file or assembly 'Microsoft.Office.Interop.Excel, Version=, Culture=neutral, PublicKeyToken=71e9bce111e9429c' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)

I am assuming this has something to do with MS Office 2010 (office 2003 is installed on the servers) 

Microsoft.Office.Interop.Excel dll files from my directory and picked the version 11. This error message still comes up. 

Please HELP!!!! Thanks

issues with Microsoft.Office.Interop.Excel in asp.net throwing Exception from HRESULT: 0x800A03EC


i m using Microsoft.Office.Interop.Excel in asp.net for Excel file as anEmail attachment .

i get the data and write to Excel but when i try to save like:

oWB.SaveAs(strCurrentDir +strFile, Microsoft.Office.Interop.Excel.


XlFileFormat.xlWorkbookNormal, null,

could not load file or assembly'Microsoft.office.interop.excel


could not load file or assembly'Microsoft.office.interop.excel, version=  , culture=neutral, public keytoken=71e9bce111e9429c' or one of its dependencies

i am getting this error when i am installing setup of my project in other machine.


Export Visio Database Table Names to Excel

If you use the Enterprise Architect edition of Microsoft Visio for data modeling regularly, then there is a good chance that at some point you've wanted to export just the table names into Excel. You might want to do this to map logical ERD entities to physical data model tables, track project status by entity, or track overlap between database versions.

Excel Automation in .Net

Excel Automation is a buzz word in both webapps and winapps. In the programming life (like Mr.Anderson neo) I guess almost every one could have come across this word. For others let me go further in detail. Excel Automation is automating some or all of the process involved in creating or updating excel worsheets.
ASP.NetWindows Application  .NET Framework  C#  VB.Net  ADO.Net  
Sql Server  SharePoint  Silverlight  Others  All   

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend