Reputation: 21
I'm trying to make a program in Excel's VBA editor that interacts with Corel. When I try to run Corel in the COM via this line:
Set cdrApp= CreateObject("CorelDRAW.Application")
I get "Runtime error '-2147418113': class not registered"
Here is some more relevant code for context:
Sub mySubroutine(ByRef inArray As Variant)
Dim cdrApp As CorelDRAW.Application
Set cdrApp = CreateObject("CorelDRAW.Application")
'Lots of irrelevant code here
End Sub
I'm also receiving a compile error at Dim cdrApp As CorelDRAW.Application
"User-defined type not defined." For the time being I've just declared this as an Object
as this is a less immediate issue.
My thinking originally was that something was wrong with the library. At first, I just had "Corel - CorelDRAW 24.5 Type Library" selected in my references, but I went into the Corel files and added every single tlb file I could find.
Then I read probably close to 40 discussion posts between the ones on here and on the Corel dev community; tried changing the datatype to As VGCore.Application
; tried hacking the CreateObject method by doing CreateObject("", "CorelDRAW.Application")
; tried doing Set cdrApp = "CorelDRAW.Application"
; tried doing Set cdrApp = New CorelDRAW.Application
; Went into the services manager and double checked the progID; As well as few other frugal things.
And, of course, I looked at the API documentation for CorelDRAW '23 24.5.
Thanks for any help.
Edit: Some more things I have tried that didn't work:
Set cdrApp = CreateObject("CorelDRAW.Application.24")
Since the CurVer key is that; Double checked the registry to ensure CorelDRAW.Application was registered (Thanks @SimonMourier); Tried reinstalling CorelDRAW, tried running everything on a 2nd PC, reinstalled corel, ensured corel's installation contained the proper settings to enable VBA
Upvotes: 0
Views: 276