Hi Roy
I greatly appreciate and thank you for all your efforts. The code given by you is simple yet very straight forward and works like a charm.
Meanwhile, I figured out the problem and got the previous code working too, by replacing "xlOpenXMLWorkbook" in the 8th line with "xlOpenXMLWorkbookMacroEnabled"..
Sub saveFileMacro()
FullFileName = Application.GetSaveAsFilename("D:\2012\Invoice\" & Format(Range("K3").Value) & ".xlsm", _
"Excel Macro-Enabled Workbook (*.xlsm),*.xlsm", 1, "Save File As")
If FullFileName <> vbNullString Then
Application.DisplayAlerts = False
ActiveWorkbook.SaveAs Filename:= _
FullFileName, FileFormat:= _
xlOpenXMLWorkbookMacroEnabled, CreateBackup:=False
ActiveWorkbook.Close
Else
MsgBox "File not saved"
End If
End Sub
As for saving with the macro, the template file contains another macro which enables few extra functions which are required to display certain fields and do some calculations, so when I save it as a normal file, those functions doesn't work.
Anyways, Thank you so much.
Anand
Bookmarks