Microsoft Office Excel cannot access the file 'c:\inetpub\wwwroot\Timesheet\App_Data\Template.xlsx'
Try this:
- 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).
- 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
Let me note that in my place, adding the c:\windows\syswow64\config\systemprofile\desktop directory didn't work.
The point is that WOW64 stands for Windows on Windows64, that means it actually applies for 32-bit programs running on the 64bit OS.
Since I have 64-bit Excel installed, the proper directory turned out to be the c:\windows\system32\config\systemprofile\desktop
In my case, I followed the suggestions provided here and solved the problem.
Steps:
- Run
dcomcnfg
- Go to Console Root \Component Services\Computers\My Computer\DCOM Config\Microsoft Excel Application
- Right click Microsoft Excel Application
- Select Properties
- Go to Identity tab
- Select The interactive user.
In step 2, if you can't locate that path then try running mmc comexp.msc /32
instead of dcomcnfg
.