CorelDRAW - VBA - Late Binding - Function ExportEx & Export


I am using CorelDRAW API within my VBA Application since years.For easier compiling and different version issues I recently changed from early to late binding. So now there is no reference to CorelDRAW.tlb necessary. After rebuilding hundreds of subs/functions everything works fine. But at the end, when exporting a document, the error 13 "type missmatch" occurs. I made many tests but could not find a problem in my code. Maybe this is a bug in the API itself?

Below a simple code, which could be tested in CorelDRAW VBA. From my point of view this code should normally work.

Private Sub Test_ExportEx_oDoc_as_Object()
'Late Binding
Dim oApp As Object
Dim oDoc As Object

Dim oExpOpt As Object
Dim oExpFlt As Object
Dim sFile As String

Set oApp = Application
Set oDoc = oApp.ActiveDocument

Set oExpOpt = oApp.CreateStructExportOptions
oExpOpt.UseColorProfile = True

sFile = "C:\temp\Test.eps"
Set oExpFlt = oDoc.ExportEx(sFile, cdrEPS, cdrCurrentPage, oExpOpt)
With oExpFlt
End With

End Sub

Has anybody experienced the same problem or a workaround? Please also respond if you can confirm, that this is likely might be a problem of the API itself.

I tried this with X7 and 2020.

Best Regards

Parents Reply Children