tags:

views:

32

answers:

1

what do you think is wrong with the commented line in my vb.net code below? it returns the error message "member not found". thank you.

Public Function tae(ByVal SourcePath As String)

    Dim oxlApp As Excel.Application
    Dim oxlBook As Excel.Workbook
    Dim oxlSheet As Excel.Worksheet

    oxlApp = CType(CreateObject("Excel.Application"), Excel.Application)
    oxlBook = CType(oxlApp.Workbooks.Open(SourcePath), Excel.Workbook)     //somethings wrong here
    oxlSheet = CType(oxlBook.Worksheets(1), Excel.Worksheet)

    oxlApp.Workbooks.Close()
    oxlApp.Quit()

End Function
A: 

i tried to add the following references and its now ok:

  • ms excel x object library
  • ms office x object library
  • visual basic for applications
sef