I have a ASP.NET application (Visual Studio 2003 - C#) where I open an Excel.Workbook. This works fine on my local PC (Windows XP), but on the webserver Windows Server 2003 it won't work.
Where I want to open an excel workbook I get an error: "Object reference not set to an instance of an object. at 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)".
In my code it looks like this:
Excel.Application XL = new Excel.ApplicationClass();
XL.Visible = false;
Excel.Workbook WB = XL.Workbooks.Open(workbookPath,
0, false, 5, "", "", false, Excel.XlPlatform.xlWindows, "",
true, false, 0, true, false, false);
I tried also:
object missingValue = Type.Missing;
Excel.Workbook WB = XL.Workbooks.Open(workbookPath,
missingValue,missingValue,missingValue,missingValue,missingValue,missingValue,missingValue,missingValue,missingValue,missingValue,missingValue,missingValue,missingValue,missingValue);
On the server there is an Excel 2000 -version.
In the Taskmanager I can see that Excel has startet.
What to do?
Where I want to open an excel workbook I get an error: "Object reference not set to an instance of an object. at 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)".
In my code it looks like this:
Excel.Application XL = new Excel.ApplicationClass();
XL.Visible = false;
Excel.Workbook WB = XL.Workbooks.Open(workbookPath,
0, false, 5, "", "", false, Excel.XlPlatform.xlWindows, "",
true, false, 0, true, false, false);
I tried also:
object missingValue = Type.Missing;
Excel.Workbook WB = XL.Workbooks.Open(workbookPath,
missingValue,missingValue,missingValue,missingValue,missingValue,missingValue,missingValue,missingValue,missingValue,missingValue,missingValue,missingValue,missingValue,missingValue);
On the server there is an Excel 2000 -version.
In the Taskmanager I can see that Excel has startet.
What to do?