I've created an ASP.Net page that generates a report based on a source Excel spreadsheet. The page works perfectly on my local server (Server 2003). However upon deploying it to another server (Server 2008), the page crashes when I attempt to open the source spreadsheet. I receive the following error message:
Open method of Workbooks class failed
Things I have tried / noticed (I'm relatively new at this, so bear with me):
1. I am able to use a macro in Excel on the new server to open the source spreadsheet with no problems.
2. I have tried using both a fully qualified path to the source spreadsheet, as well as a Server.MapPath approach. Both run into the same problem.
3. Attempting to open an invalid file name produces a different error, so it is recognizing the file (I'm not sure what this tells us though)
4. I have granted "Everyone" full access to the folders in question. I understand the inherent security risk here; I'm just trying to get the application to work first.
5. I've granted Everyone access to Excel with dcomcnfg.exe
6. I have verified that the exact same version of Excel is running on both servers. (Excel 2003, (11.5612.5606).
For the time being, I used Excel on the new server to create a blank spreadsheet named test.xls, and I am attempting to simply open that file, which can be seen in my code below.
Does anyone have any thoughts on what could be the problem? Thank you in advance for your help and patience with a neophyte such as myself.
Dim oExcelSource As Object
oExcelSource = CreateObject("Excel.Application")
oExcelSource.Workbooks.Open("C:\test.xls") ' <-- The page crashes here