Hello,
I am currently using the below code which saves a CSV into the chosen file path:
I would like for the CSV file to automatically save to the correct Year and Month folder within this path. And if the current Year/Month folder does not exist, I would like to automatically add it.
Can anyone help me with this please?
Thanks.
I am currently using the below code which saves a CSV into the chosen file path:
VBA Code:
Sheets("InputFile").Select
Sheets("InputFile").Copy
Dim Name As String
Name = Format(Now(), "DDMMYY HHMM")
ChDir _
"S:\FM\Folder1\Folder2\Folder3"
ActiveWorkbook.SaveAs Filename:= _
"S:\FM\Folder1\Folder2\Folder3\Upload " & Name & ".csv" _
, FileFormat:=xlCSV, CreateBackup:=False
ActiveWorkbook.Close SaveChanges:=True
I would like for the CSV file to automatically save to the correct Year and Month folder within this path. And if the current Year/Month folder does not exist, I would like to automatically add it.
Can anyone help me with this please?
Thanks.