TheJerkooo
TheJerkooo
  • 1
  • 10 411

Video

Excel sheet save as pdf in specific folder vba macro
Views 10K2 years ago
Sub Save_PDF () Sheets("Sheet1").Select Dim filename As String Dim ChDir As String filename = Range("A1") ChDir = "C:\Users\AntoJ\Documents\Test\" Sheets("Sheet1").Range("a1:d20").ExportAsFixedFormat Type:=xlTypePDF, filename:= _ ChDir & filename & ".pdf", Quality:=xlQualityStandard, _ IncludeDocProperties:=True, IgnorePrintAreas:=False, OpenAfterPublish:= _ False End Sub

Comments

  • Pynio Pde
    Pynio Pde 9 months ago

    run time error 5 invalid procedure call or argument!!! Someone Help

  • Radhika Basnet
    Radhika Basnet 10 months ago

    compile error,sub or function not define. help me in this error

  • uberteen999
    uberteen999 11 months ago

    EXCELLENT TUTORIAL! great content, keep it up!

  • Tushar Mehta
    Tushar Mehta Year ago

    i am getting the invalid cell argument please guide

    • Walid Dami
      Walid Dami 10 months ago

      Check the reference cell in Sheets("Sheet1").ExportAsFixedFormat

  • antshamac
    antshamac Year ago

    Hi @The Jerkooo I tried also got run time error 1004 document could not save. example of vba code

  • Clement Andoh
    Clement Andoh Year ago

    Sheets("Sheet1").Select ERROR (subscript out of range) please help

    • TheJerkooo
      TheJerkooo Year ago

      Hi, please check the name of your sheet, for this code it must be "Sheet1"

  • Zackd41pro
    Zackd41pro Year ago

    worked just fine thanks

  • funnybomb
    funnybomb Year ago

    run time error 1004 document could not be saved

    • funnybomb
      funnybomb Year ago

      @TheJerkooo thanks

    • TheJerkooo
      TheJerkooo Year ago

      Hi, you need to put your file location in vba code - ChDir