Open Excel Workbook & Cycle Sheets


i want open workbook , cycle through sheets in workbook.  below trying, gives me error of object not set instance ofa n objet

excel.application oxl;  excel._workbook owb;    wb = oxl.workbooks.open("workbookname", missing.value, true);  {  //this line throws error on owb.worksheets  foreach (excel.worksheet displayworksheet in owb.worksheets)  {  //more stuff here  }  }  

you need set wb something.  try putting code below directly above foreach line

owb = oxl.activeworkbook;



Visual Studio Languages  ,  .NET Framework  >  Visual C#



Comments

Popular posts from this blog

Azure DocumentDB Owner resource does not exist

BizTalk Server 2013 Azure VM Log Shipping and HA for hosts

How to Share webservice object to all user