BrendanDixon
Board Regular
- Joined
- Mar 7, 2010
- Messages
- 174
- Office Version
- 365
- 2019
- Platform
- Windows
Hi All,
I have a sheet where I click on a button and it will save the sheet as a PDF file with a predetermined name. The Problem I have is that I sometimes might do multiple sheets on the same day so when I click the button it will overwrite the first form. I am wonderinf is someone could tell me how to edit my code to append the filename with a 1 or 2 or 3 etc. This is my code below.
I have a sheet where I click on a button and it will save the sheet as a PDF file with a predetermined name. The Problem I have is that I sometimes might do multiple sheets on the same day so when I click the button it will overwrite the first form. I am wonderinf is someone could tell me how to edit my code to append the filename with a 1 or 2 or 3 etc. This is my code below.
Code:
ActiveWindow.SelectedSheets.PrintOut Copies:=(Sheets("Input").Range("C16").Value), Collate:=True
ActiveSheet.ExportAsFixedFormat Type:=xlTypePDF, Filename:=(Sheets("Input").Range("C17").Value & "\" & Sheets("Input").Range("C8").Value & " " & Sheets("Input").Range("D8").Value & " " & Sheets("Input").Range("E8").Value & " " & Sheets("Input").Range("C4").Value & ".pdf"), Quality:= _
xlQualityStandard, IncludeDocProperties:=True, IgnorePrintAreas:=False, _
OpenAfterPublish:=False