Shweta
Well-known Member
- Joined
- Jun 5, 2011
- Messages
- 514
Hi All,
Please help me out on the following scenario.
I am using the following code to save a workbook as a macro enable workbook on the selected path as today's date. But it is being saved as a macro free workbook.
Below is the code in module:
Sub save_file()
Dim tDate As String
Dim FileSaveName As String
Dim fPath As String
tDate = VBA.Format(DateSerial(Year(Date), Month(Date), Day(Date)), "dd-mm-yyyy")
'FileSaveName = Application.GetSaveAsFilename(InitialFileName:=tDate, filefilter:="Excel Files(*.xlsm),*.xlsm", Title:="Please save the file")
With Application.FileDialog(msoFileDialogFolderPicker)
.AllowMultiSelect = False
.Show
If .SelectedItems.Count <> 0 Then
fPath = .SelectedItems(1) & "\"
ActiveWorkbook.SaveAs fPath & tDate & ".xlsm"
End If
End With
End Sub
Any help would be appreciated! Thanks!
Regards,
Shweta
Please help me out on the following scenario.
I am using the following code to save a workbook as a macro enable workbook on the selected path as today's date. But it is being saved as a macro free workbook.
Below is the code in module:
Sub save_file()
Dim tDate As String
Dim FileSaveName As String
Dim fPath As String
tDate = VBA.Format(DateSerial(Year(Date), Month(Date), Day(Date)), "dd-mm-yyyy")
'FileSaveName = Application.GetSaveAsFilename(InitialFileName:=tDate, filefilter:="Excel Files(*.xlsm),*.xlsm", Title:="Please save the file")
With Application.FileDialog(msoFileDialogFolderPicker)
.AllowMultiSelect = False
.Show
If .SelectedItems.Count <> 0 Then
fPath = .SelectedItems(1) & "\"
ActiveWorkbook.SaveAs fPath & tDate & ".xlsm"
End If
End With
End Sub
Any help would be appreciated! Thanks!
Regards,
Shweta