I thought this wouldn't be too hard, but it's defeating me...
I want to create a copy of a file in a folder created by the VBA code. I've tried this with limited success:
The folder is created, but the default "save to" location is still the parent folder. Also, I want to be able to save it as an .xlsm format, but it's defaulting to .xlsx. Thanks in advance...
I want to create a copy of a file in a folder created by the VBA code. I've tried this with limited success:
Code:
Private Sub Workbook_BeforeSave(ByVal SaveAsUI As Boolean, Cancel As Boolean)
Dim fName, cPath, nPath, fDate As String
On Error Resume Next
fName = ThisWorkbook.Name
cPath = ThisWorkbook.Path
fDate = Format(Date, "yymmdd")
nPath = cPath & "\" & fDate & " " & fName
MkDir nPath
ChDir nPath
Application.Dialogs(xlDialogSaveAs).Show fName & ".xlsm"
End Sub