Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 4273374
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 21, 20262026-05-21T07:42:16+00:00 2026-05-21T07:42:16+00:00

Interop.Excel version 12 Office Excel 2007 I have worked on code to open .xslm

  • 0

Interop.Excel version 12

Office Excel 2007

I have worked on code to open .xslm file and then converting (saving) it as .xslx. Between this, I do need to do some processing as well but it doesn’t matter. Following is the code:

namespace Exceltest
{
    class Program
    {
        static void Main(string[] args)
        {

            Application oXL = null;
            oXL = new Application();

            oXL.Visible = false;
            oXL.DisplayAlerts = false;

            try
            {
                Workbook book = oXL.Workbooks.Open("E:\\CorrectPF1.xlsm", 0, true, 5, "access123", "", true,
                                                   XlPlatform.xlWindows, "\t", false, false, 0, true, null, XlCorruptLoad.xlNormalLoad);

                Worksheet worksheet = (Worksheet)book.Sheets["Resource allocation"];
                worksheet.Activate();

                oXL.Visible = false;
                oXL.DisplayAlerts = false;

                book.SaveAs("E:\\PF1.xlsx", XlFileFormat.xlOpenXMLWorkbook,
                                            "", Type.Missing, Type.Missing, Type.Missing, XlSaveAsAccessMode.xlNoChange,
                                                XlSaveConflictResolution.xlLocalSessionChanges, Type.Missing, Type.Missing,
                                                Type.Missing, false);
            }
            catch (Exception  ex)
            {
             //Handling exception here
            }

        }
    }
}

This code executes with no issue (without any exception) but No file is saved with .xslx extension. I found it is working for some set of files but not others. Say, it is not working for file named PF1.xslm. I am able to open PF1.xslm in Office Excel and save it as .xslx. So, the same suppose to work programmatically as well.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-21T07:42:16+00:00Added an answer on May 21, 2026 at 7:42 am

    You can’t save files with macros in it to .xlsx format. If you save a file yourself you should get an error message. I suspect the macro just gives up and doesn’t save it, rather than displaying that error message.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have code that worked in the VSTO version of an Excel Addin Microsoft.Office.Tools.Excel.ListObject
I tried to use F# read a xls file as below open Microsoft.Office.Interop.Excel let
I am creating an Excel Worksheet from C# using Microsoft.Office.Interop.Excel, and I have not
I have the following in a program (written in VB.NET): Imports Microsoft.Office.Interop.Excel Public Class
Anyone have code to set margins(top,left,right,bottom) using excel interop and vb.net. I think it
I am using Excel 2007 interop assembly to automate Excel through c#. Interop version
Issue: I am using the Microsoft.Office.Interop.Excel library in an ASP.NET application, and I have
This is all in C# .NET Excel Interop Automation for Office 2007. Say you
I have: Microsoft.Office.Interop.Excel.Workbook wb; Microsoft.Office.Interop.Excel.Name name; Is there any way to get the worksheet
I have an application that uses Microsoft.Office.Interop.Excel to pull data from an Excel workbook.

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.