Hello,
I have a macro created to save the file but for some reason .xlsm is being included in the actual name of the file. Can anyone figure out how I can prevent that from happening?
---------------------------------------------------------------------------------------------------------------------------------------------------------------
Sub SAVEAS()
'
' SAVEAS Macro
Dim save_as As Variant
Dim file_name As String
file_name = Sheets("Template").Range("D2")
' Get the file name.
save_as = Application.GetSaveAsFilename(file_name, _
FileFilter:="Excel Files,*.xlsm,All Files,*.*")
' See if the user canceled.
If save_as = False Then Exit Sub
' Save the file with the new name.
If LCase$(Right$(save_as, 4)) <> ".xlsm" Then
file_name = save_as & ".xlsm"
End If
ActiveWorkbook.SAVEAS Filename:=file_name
End Sub
----------------------------------------------------------------------------------------------------------------------------------------------------------------
I have a macro created to save the file but for some reason .xlsm is being included in the actual name of the file. Can anyone figure out how I can prevent that from happening?
---------------------------------------------------------------------------------------------------------------------------------------------------------------
Sub SAVEAS()
'
' SAVEAS Macro
Dim save_as As Variant
Dim file_name As String
file_name = Sheets("Template").Range("D2")
' Get the file name.
save_as = Application.GetSaveAsFilename(file_name, _
FileFilter:="Excel Files,*.xlsm,All Files,*.*")
' See if the user canceled.
If save_as = False Then Exit Sub
' Save the file with the new name.
If LCase$(Right$(save_as, 4)) <> ".xlsm" Then
file_name = save_as & ".xlsm"
End If
ActiveWorkbook.SAVEAS Filename:=file_name
End Sub
----------------------------------------------------------------------------------------------------------------------------------------------------------------