• Hi All

    Please note that at the Chandoo.org Forums there is Zero Tolerance to Spam

    Post Spam and you Will Be Deleted as a User

    Hui...

  • When starting a new post, to receive a quicker and more targeted answer, Please include a sample file in the initial post.

VB Code to save pdf file with different name like (1) (2)

Ateeb Ali

Member
Dear Sir,
I am using following code link with button, when it click, it save the file with cell value.
I want if the file already exist in folder, it should not replace the file, instead it saved it with extension like 123(1)

<<< use code -tags >>>

Code:
Sub PDFActiveSheet()


ActiveSheet.ExportAsFixedFormat Type:=xlTypePDF, FileName:=ThisWorkbook.Path & "\TCS Style Name " & Range("D16").Value _
, Quality:=xlQualityStandard, IncludeDocProperties:=True, IgnorePrintAreas _
:=False, OpenAfterPublish:=True

End Sub
 
Last edited by a moderator:
Back
Top