Need help understanding the error.
Dim xL as Excel.Application
xL.Sheets("General").activate() --> Error here telling "Option Strict disallows late binding"
what am i doing wrong ?
Thanks in advance
Sihi
Printable View
Need help understanding the error.
Dim xL as Excel.Application
xL.Sheets("General").activate() --> Error here telling "Option Strict disallows late binding"
what am i doing wrong ?
Thanks in advance
Sihi
try this
' this xlapp.workbooks(1).worksheets("General") returns a reference to an Object and not a reference to a worksheet.
Dim xlwork As Excel.Worksheet
' This line explicitly tells the compiler that you're going to cast xlapp.workbooks(1).worksheets as a excel.worksheet and as such
it should return a reference on a worksheet instead of an object
xlwork = ctype(xlapp.Workbooks(1).Worksheets("GENERAL"),excel.worksheet)
xlwork.activate()
Thanks guru, it works :)