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 6557421
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T13:04:17+00:00 2026-05-25T13:04:17+00:00

I have my code as follows :- Microsoft.Office.Interop.Excel.Application oXL = null; Microsoft.Office.Interop.Excel.Sheets sheets; Application

  • 0

I have my code as follows :-

Microsoft.Office.Interop.Excel.Application oXL = null;
Microsoft.Office.Interop.Excel.Sheets sheets;
Application excel = new Microsoft.Office.Interop.Excel.Application();


excel.Workbooks.Add(System.Reflection.Missing.Value);

/*
    * Here is the complete detail's about Workbook.Open()
    * 
    *  Excel.Workbooks.Open(String Filename, Object UpdateLinks, Object ReadOnly, Object Format, 
    *  Object Password, Object WriteResPassword, Object IgnoreReadOnlyRecommended, Object Origin,
    *  Object Delimiter, Object Editable, Object Notify, Object Converter, Object AddToMru, Object Local, Object CorruptLoad)
    */

Workbook workbook = excel.Workbooks.Open(
    System.Web.HttpContext.Current.Server.MapPath("~/App_Data/Template.xlsx"),
    Missing.Value, true, Missing.Value, Missing.Value,
    Missing.Value, Missing.Value, Missing.Value,
    Missing.Value, Missing.Value, Missing.Value,
    Missing.Value, Missing.Value, Missing.Value,
    Missing.Value);
sheets = workbook.Worksheets;

Now for the line :-

workbook = excel.Workbooks.Open(
    System.Web.HttpContext.Current.Server.MapPath("~/App_Data/Template.xlsx"),
    Missing.Value, true, Missing.Value, Missing.Value,
    Missing.Value, Missing.Value, Missing.Value,
    Missing.Value, Missing.Value, Missing.Value,
    Missing.Value, Missing.Value, Missing.Value,
    Missing.Value);

It gets executed directly from the visual studio (F5) but when i try to access it with IIS it wont work.
Throws error as follows:-

Microsoft Office Excel cannot access the file ‘c:\inetpub\wwwroot\Timesheet\App_Data\Template.xlsx’. There are several possible reasons:
• The file name or path does not exist.
• The file is being used by another program.
• The workbook you are trying to save has the same name as a currently open workbook.

I have tried the work around as:-

  • Folder and the file exist, giving access to the IUSR_### (IIS user) and to the ASPNET user in the folder where the file is.
    • At Component Services(DCOM) given access to appropriate user.

I have already given all permission’s to the folder where the template(.xlsx) exists

Any suggestions??

  • 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-25T13:04:17+00:00Added an answer on May 25, 2026 at 1:04 pm

    Try this:

    1. Create the directory

    C:\Windows\SysWOW64\config\systemprofile\Desktop

    (for the 32-bit version of Excel/Office on a 64-bit Windows computer) or

    C:\Windows\System32\config\systemprofile\Desktop

    (for a 32-bit version of Office on a 32-bit Windows computer or a 64-bit version of Office on a 64-bit Windows computer).

    1. For the Desktop directory, add Full control permissions for the
      relevant user (for example in Win7 & IIS 7 & DefaultAppPool set permissions for user IIS AppPool\DefaultAppPool).

    Original post with answer:

    • Excel 2007 automation on top of a Windows Server 2008 x64
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

i have the follow code: searchResults.SearchResultCollection.Add( new SearchResult() { Header = HttpUtility.HtmlDecode( htmlDocument.DocumentNode .SelectSingleNode(initialXPath
I have an application written in VB.NET that interacts with Excel via interop. I
I have a XAML code as follows: <UserControl x:Class=LabsterApp.TestExplorer.TestExplorer xmlns=http://schemas.microsoft.com/winfx/2006/xaml/presentation xmlns:x=http://schemas.microsoft.com/winfx/2006/xaml xmlns:TestExplorer=clr-namespace:LabsterApp.TestExplorer MinHeight=300> <Grid>
I have code as follows: $(#item_select).change(function() { var params = $(#item_select option:selected).val(); $.post('/account/ar_form.php', {idata:
Currently, I have some code as follows template<typename Type> Type* getValue(std::string name, bool tryUseGetter
I have code to run sql query in ruby as follows sql = ActiveRecord::Base.connection()
Suppose i have the code snippet as follows : ( clarification purpose/not well formed
I have 3 different jquery uses & put it into one code as follows:
In my code I have three classes as follows: Forum , Forum::Thread and Forum::Post
I have a section of code that can be summarised as follows; void MyFunc()

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.