title: Microsoft Excel cannot access the file "...". There are several possible reasons Windows Server 2008 R2 with Microsoft Office 2010
body: <p>I have a problem with starting the Excel Application under a particular user.</p>
  
  <p>I try to schedule this script (C#) through an application X (not Windows Task Scheduler. And this application will always use a service account to run services on the server). If I run the C# script in command prompt under the same user, it runs. Under the application X, which uses the exact same user, to initiate the C# script, it fails to open the Excel application (not sufficient permission?).</p>
  
  <p>This script calls:
  app.Workbooks.Open(ExcelFileName,0,false,Type.missing....), yet it gives the following error:</p>
  
  <p>Microsoft Excel cannot access the file "...". There are several possible reasons: </p>
  
  <p>-The file name or path does not exist.</p>
  
  <p>-The file is being used by another program.</p>
  
  <p>-The workbook you are trying to save has the same name as a currently open workbook.</p>
  
  <p>I tried all the methods that I found online to no avail.</p>
  
  <ol>
  <li>Create directory “C:\Windows\SysWOW64\config\systemprofile\Desktop” (for 64 bit Windows) or “C:\Windows\System32\config\systemprofile\Desktop” (for 32 bit Windows). Then Set full control permissions on Desktop directory above (for example in Win7 &amp; IIS 7 &amp; DefaultAppPool set permissions for user “IIS AppPool\DefaultAppPool”) </li>
  <li>Changed the DCOM config for the Microsoft Excel application to include this user for Local/Remote Launch and Access</li>
  <li>Enabled all macros in Excel and set the Trust Center.</li>
  <li>Add the user to have full control on all folders that contain the Excel file.</li>
  <li>Under DCOM config, Microsoft Excel Application, if I modify the Identity tab to check on "This User" and enter the username/password to let Excel always run under that user. Then the application runs perfectly. However, other users can't run the excel application on their own with the following error: "Cannot use object linking and embedding". If I check "Use the launching user", then Excel can't be launched. No errors in the logs or events anywhere to check.  </li>
  </ol>
  
  <p>Yet, still the same error. I think it's permission but I am not sure where and what to do for this to work.</p>
  
  <p>Now, normally, when I run this excel report, I can double-click on the file and it'd automatically run, save the new parameters into the current file and generate a new excel file (with date attached to the file name). That means there is a change (save) to the original file.</p>
  
  <p>I appreciate all your help!</p>