Hello, I'm trying to make a macro that exports my active selection as a .Jpg into a specific folder. Luckily I found (almost) exactly what I wanted in an old discussion with this code (Written by Shelby Moore):
Sub ExportJPG()Dim opt As New StructExportOptions
ActiveDocument.Unit = cdrInch opt.AntiAliasingType = cdrNormalAntiAliasing opt.ImageType = cdrRGBColorImage opt.Overwrite = True opt.ResolutionX = 300 opt.ResolutionY = 300 opt.SizeX = opt.ResolutionX * ActiveSelectionRange.SizeWidth opt.SizeY = opt.ResolutionY * ActiveSelectionRange.SizeHeight
ActiveDocument.Export "C:\Users\Jaspo\Documents\Corel\Pics\Export.jpg", cdrJPEG, cdrSelection, optEnd Sub
The only thing with this is, it overwrites my last exported photo with the same name "Export.jpg". I'd like to have a message box come up where I could name the file whatever I want.
I'm still pretty new to macros but learning a little more every day through online tutorials and looking through old discussions. But at this point I don't know enough to just write the code from scratch.
DapoDog said:Hello, I'm trying to make a macro that exports my active selection as a .Jpg into a specific folder.
You might try using my Quick Export macro.
When exporting, that can show a dialog for specifying the folder and filename, and can start in the last folder that was used.
Thanks so much!
I'm having trouble installing it though... when I try to load it into my macro manager I just get an error saying
"Unable to load project file"
Wow, I have to apologize. I was not paying attention to the fact that we are in the X6 forum.
The oldest version of CorelDRAW that I have is X7 - and that's where my macros are developed - and that may be a problem with X6.
To get the filepath from the user, I am using the CorelScriptTools.GetFileBox method.
Although that dialog allows navigation to different folders within the system, it can start in a folder specified by one of the arguments.
Thanks! I'll look into that.