Batch resave CorelDRAW files to a lower version

A simple VBA script for batch dumping CorelDRAW files to a lower version.

Sub Resave()

    'remember to add a trailing '\', for example c:\my\path\
    Dim fld As String
    fld = "c:\my\path\"
    'make the out fld different than the main fld if needed
    'files are saved with a new name, so original ones will not be overwritten
    'remember to add a trailing '\', for example c:\my\path\
    Dim outFld As String
    outFld = "c:\my\path\out\"
    If Len(dir(outFld, vbDirectory)) = 0 Then
       MkDir outFld
    End If
    Dim file As String
    Dim sopts As StructSaveAsOptions
    Set sopts = CreateStructSaveAsOptions
    With sopts
        'looks like vba is happy to save down to v1...
        'x7 is not happy to reopen them though and the lowest version it is happy with is v12
        'in the gui the lowest save as version is 11 though
        .Version = cdrVersion12
        .Overwrite = True
        .EmbedVBAProject = True
        .Filter = cdrCDR
        .IncludeCMXData = False
        .Range = cdrAllPages
        .EmbedICCProfile = True
        .KeepAppearance = True
    End With
    file = dir(fld & "*.cdr")
    Do While file <> ""
        Dim doc As Document
        Set doc = OpenDocument(fld & file)
        doc.SaveAs outFld & Replace(file, ".cdr", "_v" & sopts.Version & ".cdr"), sopts
        file = dir()
End Sub

Debugging Corel X7 .NET AddOn

There are 2 ways of debugging an X7 AddOn I am aware of:

  • Attach to a running Corel process: Debug\Attach to Process - find Corel.exe

  • Set the debug options in the project's properties, so when hitting F5 CorelDRAW is launched first

The expected behavior is now pretty obvious:

Note: When going for the latter option, make sure the path in the AppUI.xslt points to a dll that is created when compiling the project. Otherwise VS will not see the dll being loaded and debugger will not hit any breakpoints (when going for the former option, in order to avoid a need to copy a dll over and over again do debug it, it is worth adjusting the path too ;)

Corel X7 .NET AddOn

Shelbym wrote some nice guides on how to create custom .NET dockers for CorelDRAW x6. There where some changes in X7 described here.

This post is pretty much about putting the above together, so one can quickly start playing with custom tools in X7.

The content of the attached archive is as follows:

  • TestAddOn - a ready to go X7 addon; just coy it to the CorelDRAW Graphics Suite X7\Programs64\Addons and review the Window\Dockers
  • TestAddOnSolution - an extremely simplistic project to give an idea on how to start with the addon customisation
  • TestAddonTemplate - UserUI and AppUI xslts that make orel create Window\Dockers entry and load the custom dll (64.5KB)