You need to reference Microsoft Excel 12.0 Object Library or use late binding. Later, binding is almost always necessary if you are sharing your project with users who can have different versions of Excel installed.
For later binding you should:
Dim oXL as object Set oXL = CreateObject("Excel.Application")
Then your code should work as expected, without having to make a link ... unless you use any other special values ββor Excel objects.
source share