I have a macro that opens Excel from Solidworks to pull part information from a table. Recently I'm getting this error when it hits the line "set xlApp = New Excel.Application"
The error is Run-time error '-2147023728 (80070490)': Element not found.
I don't have any missing libraries, and I'm using excel.exe as my reference. (ver 16) I get this same error if I try to run this simplified code from Outlook instead of Solidworks.
Dim xlApp As Object
Sub main()
Set xlApp = New Excel.Application
End Sub
Other variants of code I've tried:
Dim xlApp As Excel.Application
Sub main()
Set xlApp = GetObject(, "Excel.Application")
End Sub
Result: Run-time error '429': ActiveX component can't create object.
If change this to:
Set xlApp = new Excel.Application
like I have in the previous example then I get the Element not found error. So, late-binding vs. early-binding has no effect.
This is all being tested with excel already running. VBA code inside Excel works fine unless I use that specific line. I can use "Application.ActiveWorkbook" inside Excel without error and without defining Application (because it's already Excel).
I have removed and reinstalled Office to no avail. Researching hasn't directed me to anything similar for other solutions to try.
Thanks in advance. -Taylor