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
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.
Drop it in before the 'set expflt'
You'll also need to change the first part in "" s:\1-jobs... that's what's saving it as the same name all the time.
also where you have 2386,3300, that is the size you are saving(I think) and if you are different from that in your selection it is going to squish or stretch your export.