Author: simsen | Posted on: 1/3/2009 8:24:13 AM | Views : 319

Hi,

I'm trying to open a existing excel workbook, but get the error:

Objectreference not set to an instance of an object


in the following line of code:

WRwb = WRwbs.Open(folderadress, 0, true, 5, "", "", true, Microsoft.Office.Interop.Excel.XlPlatform.xlWindows, "\t", false, false, 0, true, true, "XLNormalLoad");


I cann't figure out why I get this error. I have checked the folderaddress severel times, and it's the correct path to the file and filename.

Please can anyone see, what the error is?

My code look like this:

  //create Excel objects
string folderadress = "~/Excel/KØRSELSRAPPORT.xlsx";
folderadress = HttpContext.Current.Server.MapPath(folderadress);
Microsoft.Office.Interop.Excel.Application WRExcel = Go to the complete details ...