Wednesday, September 23, 2009

Cannot implicitly convert type 'object' to 'Microsoft.Office.Interop.Excel.Worksheet'.

on C#, there was an Error when you are using Interop Excel Object:-

Cannot implicitly convert type 'object' to 'Microsoft.Office.Interop.Excel.Worksheet'. An explicit conversion exists (are you missing a cast?) throws up when there is no Explicit casting - (Excel.Worksheet)

Excel.Worksheet oWorkSt =oWB.Worksheets[1];

To

Excel.Worksheet oWorkSt = (Excel.Worksheet)oWorkSt.Worksheets[1];

No comments:

Post a Comment