0

I'm getting a System.Exception: 'Cannot create ActiveX component.' on the corelApp = CreateObject("CorelDRAW.Application")

I have the proper reference libraries imported and the excel.application line works fine. What would prevent the system from creating a CorelDraw.Application object?

I have explored the problem here Intemittent Cannot create ActiveX component and here ASP.NET Cannot create ActiveX component to no avail. And I have explored the CorelDRAW Macro Programming Guide to find a solution, but according to the guide I am doing everything correctly.

Public Class Form1
    Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
    Dim excelApp As Object

    excelApp = CreateObject("excel.application")

    Dim corelApp As CorelDRAW.Application

    corelApp = CreateObject("CorelDRAW.Application")


    End Sub
End Class
Community
  • 1
  • 1
James Cunningham
  • 121
  • 1
  • 12
  • Is your app set to "Any CPU"? – Nikolay May 19 '17 at 20:12
  • Yes. I double checked this just a minute ago. – James Cunningham May 19 '17 at 20:16
  • 1
    Well, it should not :) It should be set to x86 – Nikolay May 19 '17 at 20:17
  • Still getting the same exception. As a side question, is this because of the 32-bit dependencies? – James Cunningham May 19 '17 at 20:19
  • Okay. Then no idea.. sorry – Nikolay May 19 '17 at 20:19
  • 1
    This is an obvious question, but is CorelDraw installed on the target computer? You can build against the interops successfully and still not be able to run if CorelDraw is not installed. If it is, have you looked up and verified that "CorelDRAW.Application" is in HKEY_CLASSES_ROOT. Have you looked at the CLSID for CorelDRAW,Application and then looked and verified that there is a valid LocalServer32 registry key with a valid value? – Joseph Willcoxson May 20 '17 at 03:51
  • It is installed on this PC. However, your comment had me look in the HKEY_CLASSES_ROOT to find out that CorelDRAW.Application has to have the program number on the end of it as I have multiple versions of Corel on this PC. "CorelDRAW.Application" is now "CorelDRAW.Application.16" and the app is able to create the object. Thank you so much. If you add this as an answer I will totally upvote it. – James Cunningham May 22 '17 at 12:27

0 Answers0