Export Macro

I export a proof jpeg for my customer on near every file I open. My basic setting are

max width or height 11"
300 dpi
Apply ICC

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 now
    OriginalFileName = ActiveDocument.FileName
    ' Conditional If...Then...Else statement
        If OriginalFileName = Empty Then
            ' Calls the MsgBox function
            OriginalFileName = "NoFileNameYet1234"
        End If
    ' Now take off the extention
    FileNameLength = 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 exporting
        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
        End If

Reply Children