Hi Folks,
So I have two Subs that I would like to work together. One to create a new folder, if it doesn't already exist and the second to SaveAs with the file name based on cell values.
I would like for the code to
1) create the folder (if needed)
2) SaveAs with new file name (based on cell values)
3) Place new file in the folder created.
So far I have items 1 and 2 working independently, but the moment have yet to be able to get the workbook to save to the folder created with Sub IfNewFolder.
If anyone can help, i'd greatly appreciate it. I've been scouring the internet for almost a month and have now been given a dead line (if i can't get it to work, we'll just go back to the old way. doable, but deplorable )
Thank you,
Blu
So I have two Subs that I would like to work together. One to create a new folder, if it doesn't already exist and the second to SaveAs with the file name based on cell values.
I would like for the code to
1) create the folder (if needed)
2) SaveAs with new file name (based on cell values)
3) Place new file in the folder created.
So far I have items 1 and 2 working independently, but the moment have yet to be able to get the workbook to save to the folder created with Sub IfNewFolder.
If anyone can help, i'd greatly appreciate it. I've been scouring the internet for almost a month and have now been given a dead line (if i can't get it to work, we'll just go back to the old way. doable, but deplorable )
Code:
Sub IfNewFolder()
Dim part1 As String
Dim part3 As String
Dim FolderCreate As String
part1 = Range("E4").Value
part3 = Range("C10").Value
If Len(Dir("O:\Human Capital\Training\Client Facing Training\Customers\ " & part3, vbDirectory)) = 0 Then
MkDir "O:\Human Capital\Training\Client Facing Training\Customers" & part3
End If
End Sub
Code:
Sub SaveCustomizedCourse()
Dim part1 As String
Dim part3 As String
part1 = Range("E4").Value 'Quote Number
part3 = Range("C10").Value 'Company Name
ChDir "O:\Human Capital\Training\Client Facing Training\Customers\" ' From what I've read on the internet, this is telling excel to save files to this directory...
' Creates file to directory Customers. But I can't get it to recognize the new folder created in the sub above...
ActiveWorkbook.SaveAs Filename:= _
"O:\Human Capital\Training\Client Facing Training\Customers" & part1 & "_" & part3 & "_Custom.xlsm", FileFormat:= _
xlOpenXMLWorkbookMacroEnabled, CreateBackup:=False
End Sub
Thank you,
Blu