Paula,
I think you need to change
Dim wkbk As New Microsoft.Office.Interop.Excel.Workbook
to
Dim wkbk As New Microsoft.Office.Interop.Excel.Workbooks
Note that this is plural "workbookS" not singular "workbook".
Just as a stylistic note, I would also change
Imports Microsoft.Office.Interop.Excel
to
Imports Excel = Microsoft.Office.Interop.Excel
--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting, LLC
www.cpearson.com
(email address is on the web site)
"Paula" <(E-Mail Removed)> wrote in message
news:95D8F42E-4661-4441-8505-(E-Mail Removed)...
> Imports Microsoft.Office.Interop.Excel
>
> Public Class TransferTool
>
> Private Sub btn_PrevData_Click(ByVal sender As System.Object, ByVal e As
> System.EventArgs) Handles btn_PrevData.Click
> Dim wkbk As New Microsoft.Office.Interop.Excel.Workbook
> wkbk.Open(Me.txt_ImportFile.Text)
>
> strWrkBkNm = wkbk.Item(1).Name
> wkbk.Close()
> wkbk = Nothing
>
> Gives an unspecified error, does anyone know why this will not run? Do I
> need to install something?
>
> Thanks,
> Paula