Hey,
So I managed to create the following code to save a folder using 4 different variables for the file path and file name.
But firstly I need to check if a folder/filepath exists, if not to create one e.g. C:\Users\Tiana\Documents\Branch Merchandising\SS17\Branch Stock Report\Week 49.. so check if week 49 exists, if it does carry on, if not create a week 49 folder.. or week 50 etc etc. and then once it's saved to then export Sheet(1) as PDF.
Greatly appreciate all the help even if it's to tidy my existing code up!
Thanks,
So I managed to create the following code to save a folder using 4 different variables for the file path and file name.
But firstly I need to check if a folder/filepath exists, if not to create one e.g. C:\Users\Tiana\Documents\Branch Merchandising\SS17\Branch Stock Report\Week 49.. so check if week 49 exists, if it does carry on, if not create a week 49 folder.. or week 50 etc etc. and then once it's saved to then export Sheet(1) as PDF.
Greatly appreciate all the help even if it's to tidy my existing code up!
Thanks,
Code:
Sub SaveAsAndExport()
Dim FPath As String
Dim Season As Range, Yr As Range, Wk As Range, Day As Range
Set Season = ActiveWorkbook.ActiveSheet.Range("M1")
Set Yr = ActiveWorkbook.ActiveSheet.Range("M2")
Set Wk = ActiveWorkbook.ActiveSheet.Range("M3")
Set Day = ActiveWorkbook.ActiveSheet.Range("M4")
Application.DisplayAlerts = False
FPath = "C:\Users\xxxxx\Documents\Branch Merchandising\" & Season & Yr & _
"\Branch Stock Report\Week " & Wk & "\"
ActiveWorkbook.SaveAs FPath & Season & Yr & " " & "Week " & Wk & " " & Day & " - Branch Stock Report" & ".xlsm"
End Sub
Last edited: