New CorelDraw Export Macro with Automatic Timestamp

Hello, forum members!

I wanted to share a CorelDraw export macro that I recently developed. This macro automatically adds a timestamp to all exported files, ensuring that no work is lost even if the computer shuts down unexpectedly.

My Motivation

I used to face significant issues with losing files in CorelDraw, especially when the computer would shut down unexpectedly or there was a power failure. I wasted a lot of time redoing work and reorganizing files. To solve this, I created this macro that automatically saves files with a timestamp, making recovery much easier and more secure.

Benefits of the Timestamp Macro

  • Security and Backup: Each exported file has a unique timestamp, ensuring you always have a recent version of your work saved.
  • Organization: Helps organize files, allowing you to quickly identify the most recent version.
  • Efficiency: Automates the export process, saving time and reducing the chance of manual errors.

How It Works

The macro is straightforward to use. When exporting your file, it automatically adds the date and time to the file name in the format YYYY-MM-DD-HH-MM-SS before the extension. For example, if you export a file named “LBExport” on May 28, 2024, at 14:35:00, it will be saved as “LBExport-2024-05-28-14-35-00.ai”.

Modifying the Original Macro

To add this functionality to your existing macro, you need to insert the following lines of code:

Dim outputFolder As String
outputFolder = "C:" & Environ("HOMEPATH") & "\LBbackup"
If Len(Dir(outputFolder, vbDirectory)) = 0 Then MkDir outputFolder
Dim dateTime As String
dateTime = Format(Now(), "yyyy-MM-dd-hh-mm-ss")
Dim outputFile As String
outputFile = outputFolder & "\LBExport-" & dateTime & ".ai"

Insert these lines between the line Dim expflt As ExportFilter and the line If Len(Dir$(outputFile)) > 0 Then.

Feedback

I’m open to suggestions and improvements! If you encounter any issues or have ideas for enhancing the macro, please leave your comments below. I hope this tool helps everyone avoid losing important work and keeps your projects safe and organized.

Best regards,

Hugo


I hope this helps! If you need anything else, feel free to ask.

3 Likes