Results 1 to 14 of 14

Thread: VBA how to use date to write file name in PDF

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #3
    VBAX Regular
    Joined
    Oct 2018
    Location
    Antwerp
    Posts
    41
    Location
    Dim volgnr As Long
    Dim slo As String
    Dim Toganr As Long
    Dim bedrag As Currency
    Dim fname As String
    Dim datedoc As Date
    volgnr = Range("B1")
    slo = Range("B2")
    Toganr = Range("B3")
    bedrag = Range("B4")
    datedoc = Range("B5")
    Path = "C:\Users\gebruiker\factuur"
    ' fname = Toganr & slo & volgnr & datedoc
    fname = Toganr & " - " & slo & " - " & volgnr & " - " & datedoc
    ActiveSheet.ExportAsFixedFormat Type:=xlTypePDF, ignoreprintareas:=False, Filename:=Path & fname
    ______
    Here I did put the value of cell B5 into "datedoc".
    The macro does not work.
    Last edited by Aussiebear; 06-26-2022 at 02:50 AM. Reason: Added code tags to supplied code

Posting Permissions

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