Hi everybody.
I need generic code to add a new workbook & save it using a filename format & for some reason the code below is not working.
What I am trying to do ultimately is, from a master annual workbook,
add a new workbook to a subfolder named after the relevant month (03 for March etc) & save to that folder as "DC" & mm (march would be DC03). This file is known as the monthly master as there could be up to 10 CSV files per month to be consolidated into the master monthly.
I then do other things with these montly files to consolidate into annual file but for the moment I have this key problem & this is what I have
It won't save the file to the folder I am trying to nominate by user input called "mnth". So I want create a master file for the month & save that file in the monthly folder.
My code works as separate operations but there is still a bit of automation I can do as one coding operation.
I also need this as I have 2 other operations I do monthly that will use this code.
Cheers for any help
I need generic code to add a new workbook & save it using a filename format & for some reason the code below is not working.
What I am trying to do ultimately is, from a master annual workbook,
add a new workbook to a subfolder named after the relevant month (03 for March etc) & save to that folder as "DC" & mm (march would be DC03). This file is known as the monthly master as there could be up to 10 CSV files per month to be consolidated into the master monthly.
I then do other things with these montly files to consolidate into annual file but for the moment I have this key problem & this is what I have
Code:
Set NewBook = Workbooks.Add
With NewBook
.Title = "DC08" & mnth
.Subject = "DC"
.SaveAs Filename:="C:\Documents and Settings\New Owner\My Documents\AT\BNZ TransactionsHist\08DC\" _
& mnth & "\" & "DC08" & mnth
End With
It won't save the file to the folder I am trying to nominate by user input called "mnth". So I want create a master file for the month & save that file in the monthly folder.
My code works as separate operations but there is still a bit of automation I can do as one coding operation.
I also need this as I have 2 other operations I do monthly that will use this code.
Cheers for any help
Last edited: