jimmyjimmyv
New Member
- Joined
- Jun 20, 2022
- Messages
- 3
- Office Version
- 365
- Platform
- Windows
Hi, I've looked around here for the answer but could find any like mine and my go-to IT Mgr. no longer works here, so I'm having to learn all of this on my own. The VBA code I have saves the current .xlsm as .xlsx as it's supposed to. It is a checklist and I'm wanting to save the workbook in a known folder S:\myfiles, in a subfolder named as "customer" in K1, then subfolder "customer part number" named in K2.
So, S:\myfiles\K1 value\K2 value\Customer Name - Customer Part number.xlsx
If the first subfolder isn't made, create it. If it's already made, just create the second subfolder, it will always need to be created.
Here's what I have that works well at saving in the main folder.
Sub FileNameAsCellContent()
Dim FileName As String
Dim Path As String
Application.DisplayAlerts = False
Path = "S:\myfiles\"
FileName = Range("K1").Value & ".xlsx"
ActiveWorkbook.SaveAs Path & FileName, xlOpenXMLWorkbook
Application.DisplayAlerts = True
End Sub
I tried adding the following, but it didn't work.
Path = "S:\myfiles\" & [K2] & "\" & [K3] & "\"
MakeDirMulti (Path)
I'm on 365, if that helps any. Thanks a WHOLE BUNCH for any help you can give me.
Jimmy
So, S:\myfiles\K1 value\K2 value\Customer Name - Customer Part number.xlsx
If the first subfolder isn't made, create it. If it's already made, just create the second subfolder, it will always need to be created.
Here's what I have that works well at saving in the main folder.
Sub FileNameAsCellContent()
Dim FileName As String
Dim Path As String
Application.DisplayAlerts = False
Path = "S:\myfiles\"
FileName = Range("K1").Value & ".xlsx"
ActiveWorkbook.SaveAs Path & FileName, xlOpenXMLWorkbook
Application.DisplayAlerts = True
End Sub
I tried adding the following, but it didn't work.
Path = "S:\myfiles\" & [K2] & "\" & [K3] & "\"
MakeDirMulti (Path)
I'm on 365, if that helps any. Thanks a WHOLE BUNCH for any help you can give me.
Jimmy