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

SQL Server 2008 - High Memory Usage

BizTalk Server 2013 Azure VM Log Shipping and HA for hosts

Problem In Configuring Biztalk 2009 In Creating A ReceivePort.When I Try To Create A Receive POrt I Got This Error