Hi all,
Thanks in advance for your time and apologies if there is a similar post somewhere with in the forum. I've searched around but can't seem to find what I'm looking for.
I was to save my worksheet as a PDF in a folder based on the month in a specific cell. I've previously acheived this but can't for the life of me figure out how I managed it. The worksheet got corrupted and I had to start again.
Here is my current code:
Sub SaveInvAsPDF()
Dim NewFN As Variant
' Copy Invoice to a new workbook
NewFN = "D:\...\inv" & Range("G15").Value & " - " & Range("A14").Value & ".pdf"
ActiveSheet.ExportAsFixedFormat Type:=xlTypePDF, FileName:=NewFN, Quality:=xlQualityStandard, IncludeDocProperties:=True, IgnorePrintAreas _
:=False, OpenAfterPublish:=True
NextInvoice
End Sub
Basically, I want it to save in a folder based on a month in a date cell (G13) with the actual file name being "inv 'G15' - 'A14'.pdf" The save name bit currently works but I can't seem to get it to save in the specific folder, which are already generated, if that makes sense.
I've tried something similar as
Dim GetMonth As Variant
GetMonth = Range("G13").Value Format(Date,"mmm")
and inserted it as
NewFN = "D:\...\inv\" & GetMonth & "\" & Range("G15").Value & " - " & Range("A14").Value & ".pdf"
but it saves to a different location with the file name as either "False.pdf" or "invFALSE.pdf"
Any help is much appriciated.
Cheers
Tom
Bookmarks