I export a proof jpeg for my customer on near every file I open. My basic setting are
max width or height 11"300 dpiApply ICCAnti-aliasing
My problem writing the macro is I can't get it to save it as the same name as the open file. It saves the file name that I recorded the macro with. I read up and do not see the correct code to pull the current file name to save it as. Any assistant will help.
see if this helps it's part of a macro I wrote for something similar. It grabs the name, strips the extention off of it, and prompts you to see if you want to change it. If for some reason you haven't saved it yet, it calls the file "NoFileNameYet" (the 1234 is stripped off in the second step.)
You'll need to dim some things like OriginalFileName, FileNameLength, ProofName (where I store the stripped down name)
' Get the name of the file right nowOriginalFileName = ActiveDocument.FileName' Conditional If...Then...Else statement If OriginalFileName = Empty Then ' Calls the MsgBox function OriginalFileName = "NoFileNameYet1234" Else End If ' Now take off the extentionFileNameLength = Len(OriginalFileName)FileNameLength = FileNameLength - 4' Now reset the file name variable without the extention.OriginalFileName = Left(OriginalFileName, FileNameLength)' Give the user a chance to edit the name of the files we'll be exportingGetFileName: ProofName = InputBox(prompt:="Name of file", Default:=OriginalFileName) ' Conditional If...Then...Else statement If ProofName = Empty Then ' Calls the MsgBox function MsgBox prompt:="You did not enter a file name." GoTo GetFileName Else End If
Joseph Ordoyne said:Any assistant will help.
Hi.
Post your recorded code here and we'll put it together for you.
-John
In X5 ActiveDocument.Name return only name without ".cdr". And If the document not saved, return temporary name like "Untitled-1". So, Len and Empty no need here.
Sancho said: In X5 ActiveDocument.Name return only name without ".cdr". And If the document not saved, return temporary name like "Untitled-1". So, Len and Empty no need here.
....Empty, hmmm, sounds like my brain...LOL
Mike your code looks great, though I must admit, I only know HTML, and PHP. How can I incorporate this into-----------------------------------------------------------------
Dim OrigSelection As ShapeRange
Set OrigSelection = ActiveSelectionRange
OrigSelection.CreateSelection
Dim expflt As ExportFilter
Set expflt = ActiveDocument.ExportBitmap("S:\1-Jobs\Signs In Progress\E-Mail Proofs\154637 Speede (Cardinal Standards).jpg", cdrJPEG, cdrSelection, cdrRGBColorImage, 2386, 3300, 300, 300, cdrNormalAntiAliasing, False, False, True, False, cdrCompressionNone)
With expflt
.Progressive = False
.Optimized = True
.SubFormat = 0
.Compression = 2
.Smoothing = 0
.Finish
End With
End Sub
-------------------------------------------------------------------------------
Thank you group for your quick reply.