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:
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
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...
...this was originally posted here: http://www.mrexcel.com/forum/excel-q...ml#post4196065
but I didn't get any good responses.
Bookmarks