pcm034
09-30-2012, 09:27 AM
I am very new to VBA and require some help with saving a backup file through a button function. Can someone point me in the right direction? I would like for the file to automatically save from a multiple cell values as the name. Here is the code that I have.
ElseIf Application.Caller = "SaveAsExcelButton" Then
Dim Fname As String
MsgBox "Where would you like to save the Excel Backup of this Quote"
Fname = Application.GetSaveAsFilename("", _
FileFilter:="Excel Filer (*.xlsm), *.xlsm", _
Title:="Save Quote Backup")
If Fname = False Then
MsgBox "You did not select a save location"
Else
ActiveWorkbook.SaveAs Filename:= _
Fname + ".xlsm", FileFormat:=xlOpenXMLWorkbookMacroEnabled, CreateBackup:=False
End If
Else
MsgBox "Not sure what happened"
End If
ElseIf Application.Caller = "SaveAsExcelButton" Then
Dim Fname As String
MsgBox "Where would you like to save the Excel Backup of this Quote"
Fname = Application.GetSaveAsFilename("", _
FileFilter:="Excel Filer (*.xlsm), *.xlsm", _
Title:="Save Quote Backup")
If Fname = False Then
MsgBox "You did not select a save location"
Else
ActiveWorkbook.SaveAs Filename:= _
Fname + ".xlsm", FileFormat:=xlOpenXMLWorkbookMacroEnabled, CreateBackup:=False
End If
Else
MsgBox "Not sure what happened"
End If