Save PDF with a unique title using VBA

  • Code
    For N = 0 To KPageNames.Count - 1
    KOutput = KBase & "\" & KPageNames(N) & ".pdf"
    Worksheets(KPageNames(N)).ExportAsFixedFormat Type:=xlTypePDF, Filename:=KOutput, Quality:=xlQualityStandard, IncludeDocProperties:=True, IgnorePrintAreas:=False, OpenAfterPublish:=False
    Next N

    This code segment prints the selected sheets (specified in the KPageNames list) to separate pdfs. When I upload these pdfs to the web, and open them from the web, the title appears as "loadFile.asp". I need a way to specify what the title is for each pdf - and I need the title to be different from the filename.

    Is there a solution to this?

  • Welcome to the Forum. Please read the Forum Rules to understand how the Forum works and why I have added Code Tags to your post

    All VBA code posted in the forum must be wrapped in code tags, which you omitted, including single-line code snippets.Be sure to use them in future posts.

    How to use code tags

    Just highlight all of the code and press the <> in the post menu above button to add the code tags.


Participate now!

Don’t have an account yet? Register yourself now and be a part of our community!