Click to See Complete Forum and Search --> : workbook


AlexanderCZ
November 25th, 2002, 09:34 AM
hi,i have problem with opening workbook in excel using VB7:

Public excapp As Excel.Application
Public workb As Excel.Workbook

Public Function OpenExcel() As Boolean

excapp = GetObject(, "Excel.Application")

str2 = "filename.xls"
str = System.IO.Path.GetFullPath(str2)
workb = excapp.Workbooks.Open(str)
End Function

i think that workb should be valid workbook,but it doesn't.some error occure described as"old format or invalid type library".
I am not vb programmer,so be patient with me...
thanks for reply

[Cakkie: Moved from VB to VB.Net forum]

Athley
November 25th, 2002, 10:54 AM
This works for me:

Dim xlApp As New Excel.Application()
Dim xlWb As Excel.Workbook = xlApp.Workbooks.Open(str2)

/Leyan