I have a Master.xlsm i need to save a lot of times in another name.
I need a simple VBA Code to Save As in the specific FileType.xlsm
And if the code don't GetTheFileName Master.xlsm in the SaveAsForm, but I need to write something to save the file, it would be good.
I have this code below, but it get's the FileName in the SaveAsForm.
And if I call the file for "1", it will save it as "1.xlsm.xlsm".
Can somebody please help me with a simple code?
Thank you in advance.
Ib
Private Sub CommandButton1_Click()
Dim file_name As Variant
' Get the file name.
file_name = Application.GetSaveAsFilename( _
fileFilter:="Excel Files,*.xlsm,All Files,*.*", _
Title:="Save As File Name")
' See if the user canceled.
If file_name = False Then Exit Sub
' Save the file with the new name.
If LCase$(Right$(file_name, 4)) <> ".xlsm" Then
file_name = file_name & ".xlsm"
End If
ActiveWorkbook.SaveAs Filename:=file_name
End Sub
Bookmarks