Results 1 to 2 of 2

Thread: Save as PDF - File name in a cell

  1. #1

    Save as PDF - File name in a cell



    Register for a FREE account, and/
    or Log in to avoid these ads!

    Hi,

    I'm having a problem here which I searched in forums and I tried to fix it based on what I learned yet no success. I need solution urgent so I might seek an answer in other forums as well. ( Cross post policy)

    I wanted to create a macro selects some part of my worksheet and saves it in to the defined directory with the file name in A1.
    A1 had the formula as the file name display. I thought it was the problem so I moved the formula to A2, added Copy-Paste Values action to the macro (copy to A1 again) But still the same problem. It gives me an error saying File Not saved.

    Here below is the code

    I would appreciate if anyone could point out the mistake....


    Sub PP()
    '
    ' PP Macro
    '
    ' Keyboard Shortcut: Ctrl+Shift+P
    '
    Range("A2").Select
    Selection.Copy
    Range("A1").Select
    Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
    :=False, Transpose:=False
    Application.CutCopyMode = False
    Range("A1:U86").Select
    Selection.ExportAsFixedFormat Type:=xlTypePDF, Filename:= _
    "C:\Users\Murat Erguden\Dropbox\PLANET\5STAR CHA\PAYROLL\2017\ & Range("A1").Value ".pdf" _
    , Quality:=xlQualityStandard, IncludeDocProperties:=True, IgnorePrintAreas _
    :=False, OpenAfterPublish:=True
    Application.WindowState = xlNormal
    End Sub

  2. #2
    Admin Alumnus Pecoflyer's Avatar
    Join Date
    Oct 2011
    Location
    Brussels Belgium
    Posts
    1,750
    Articles
    0
    Excel Version
    2010 on Xubuntu
    Last edited by Pecoflyer; 2016-11-09 at 08:32 AM.
    Thank you Ken for this secure forum.

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •