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

job syspolicy_purge_history job fail in sqlserver 2008

Trying to register with public marketplace error with 'Get-AzureStackStampInformation'