ActiveX component can't create object Excel.Application
14,376
Sometimes creating objects and not releasing them when you're finished can get things fouled up. Check your Task Manager and see if there are multiple "excel.exe" tasks running. Also note by default when they are created, they do not become visible unless you set the property after instantiating the object variable.
Sometimes rebooting the PC and trying this first will work. If it works after a fresh reboot, then stops working, something's not getting released properly.
Related videos on Youtube
Author by
user8838318
Updated on June 04, 2022Comments
-
user8838318 almost 2 years
My code, running in MS Access 2010:
Sub test() Dim xl as Object set xl = CreateObject("Excel.Application") End Sub
For whatever reason I am getting the error
ActiveX component can't create object.
I don't know why -- I go to Tools -> References and I even add the Microsoft Excel library, but still nothing.
-
Bassie over 6 yearsDid you try any of the solutions posted here stackoverflow.com/questions/656934/…
-
user8838318 over 6 yearsI don't think any of those solutions apply to this specific scenario -- this code works from the MS Access .mdb databases but not the newer .accdb ones.
-
Erik A over 6 yearsCan you do
Dim xl As New Excel.Application
? -
user8838318 over 6 years@ErikvonAsmuth Yes but that's only because I went back and included the reference (Early binding I believe), the late binding is not working though as per the original post
-
Pankaj Jaju over 6 yearsThe code works fine from .accdb database (used 2013 access)
-
Minty over 6 yearsI use that method all the time and it is late binding - it definitely works in Access 2010 . Does it compile?
-
Erik A over 6 yearsI'd reread that link shared by Bassie. I think some of them are applicable to your situation (you need to register the right DLL, though). Another option is simply reinstalling Office. It should just work, and it should not matter if you're using an .mdb or an .accdb file.
-