Missing member exception in VB.net app accessing Excel

Occasional Visitor

Here is my code that creates a missing member exception:

Dim app As New Excel.Application
Dim wb As Excel.Workbook
wb = app.Workbooks.Open(wbName)
Dim ws As Excel.Worksheet
ws = CType(wb.Worksheets(wsName), Excel.Worksheet)
ws = wb.ActiveSheet

Dim temval As Integer = ws.Cells(4, cc + cOff).value

 

When I turn on Option Strict: the above statement is flagged as an error saying that Late Binding is not allowed.

 

With Option Strict off I get the Missing Member exception at runtime.

 

Any advice would be greatly appreciated.

0 Replies