Quantcast
Channel: Visual C# forum
Viewing all articles
Browse latest Browse all 31927

Open Excel Workbook & Cycle Sheets

$
0
0

I want to open a workbook and cycle through the sheets in the workbook.  Below is what I am trying, but it gives me an error of Object not set to an instance ofa n objet

Excel.Application oXL;
Excel._Workbook oWB;

wb = oXL.Workbooks.Open("WorkbookName", Missing.Value, true);
{
//This line throws the error on the oWB.Worksheets
foreach (Excel.Worksheet displayWorksheet in oWB.Worksheets)
{
//more stuff here
}
}


Viewing all articles
Browse latest Browse all 31927

Latest Images

Trending Articles



Latest Images

<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>