how Rename output(pdf) file in vba code?

iroyal2016

New member
Local time
, 17:33
Joined
Apr 18, 2016
Messages
8
hello every one,

after searching on websites for solutions to my problem which is :
how to rename my pdf file that's include name and let say the date of today, and I found the answer for that, and I would like to share with you :

Code:
Sub CreatePDFandRenameit()
Dim x As Variant
Dim y As Variant
Dim t As Variant
Dim d As String
' it's must formatting like this because the name of the file on windows doesn't accept "/" in it.
d = Format(Date, "dd-mm-yyyy")
x = "BudjetReporton" & d & ".pdf"
y = "C:\Users\PCD\Desktop\MSDCLAIMOUT\"
t = y & x
DoCmd.OutputTo acOutputReport, "Query4", acFormatPDF, t, False, , , acExportQualityScreen
End Sub

thanks a lot

good luck every one
 

Users who are viewing this thread

Back
Top Bottom