Subject:
Dear users in this Developer Area. I’m new to this developer group.
I am interested in creating a macro that can perform the following task, given a document containing both shapes and text: export the selected part of the document to EMF format, ensuring that all text objects are exported as curves.
Unfortunately, CorelDRAW (at least not in version 2024, which I’m licensed for) does not provide an option in the export dialog to choose “Export as Curves”, as it does for PDF, WMF, and EPS exports. This is a problem for me.
Background: With the arrival of Windows 11, it seems Microsoft has shifted from GDI Classic to GDI+ (Graphics Device Interface Plus). My issue is that I need to insert EMF graphics into Word documents — something I do very frequently. When such graphics contain text, Word scales them upon insertion. Therefore, converting all text to curves before export is essential.
I hope someone can tell me whether it’s possible to create such a macro.
Best regards,
Erik
Try code below, before use change path file to be exported
Sub Macro1()Dim OrigSelection As ShapeRange Set OrigSelection = ActiveSelectionRange OrigSelection.ConvertToCurves Dim expopt As StructExportOptions Set expopt = CreateStructExportOptions expopt.UseColorProfile = False Dim expflt As ExportFilter Set expflt = ActiveDocument.ExportEx("C:\Users\your user name\documents\test.emf", cdrEMF, cdrSelection, expopt) expflt.Finish ActiveDocument.UndoEnd Sub
"C:\Users\your user name\documents\test.emf"
can be replaced with
Environ("USERPROFILE") & "\documents\test.emf"
Thank you.
Excellent! It works as intended. With sharks small change I added it to a module and made a button with an icon in the Toolbar in order to be able to access it quickly.
Could it be improved to make a dialog appear for the user to decide the folder and name of the exported EMF file?
Add next code:
Dim FName$ . . . FName = CorelScriptTools.GetFileBox("Extended Metafile Windows|*.emf", "Export document As...", 1) If Len(FName) > 0 Then Set expflt = ActiveDocument.ExportEx(FName, cdrEMF, cdrSelection, expopt) expflt.Finish End If ActiveDocument.Undo