D
deko
I'm using late binding, and for some reason I'm getting lost trying to set a
reference to a Workbook object:
Dim xlapp As Object
Dim xlwkbs As Object
Dim xlwkb As Object
Set xlapp = CreateObject("Excel.Application")
Set xlwkbs = xlapp.Workbooks
so far so good (I think), but when I try to set a reference to a Workbook, I
get a "Subscript out of range" error
Set xlwkb = xlwkbs(strPathToFile)
What I want to do is set the reference and then pass xlwkb to another
function and do stuff like add worksheets. Do I need to set the reference
differently?
Thanks in advance.
reference to a Workbook object:
Dim xlapp As Object
Dim xlwkbs As Object
Dim xlwkb As Object
Set xlapp = CreateObject("Excel.Application")
Set xlwkbs = xlapp.Workbooks
so far so good (I think), but when I try to set a reference to a Workbook, I
get a "Subscript out of range" error
Set xlwkb = xlwkbs(strPathToFile)
What I want to do is set the reference and then pass xlwkb to another
function and do stuff like add worksheets. Do I need to set the reference
differently?
Thanks in advance.