I am attempting to create a button that will save an excel spreadsheet as a non-macro xlsx file. I'm new to VBS and was pretty proud that I got a button to add a row at the top and maintain formatting but this save button is driving me bonkers. Also will this script allow the user to choose where they want to save the file? I need that functionality as well. Here's what I've hobbled together scouring the web so far:
Sub SaveButton(tempFilePath As String, tempFileName As String)
Dim Builders_Risk As Workbook
Dim SaveFormat As Long
'Remember the users setting
SaveFormat = Application.DefaultSaveFormat
'Set it to the 2010 file format
Application.DefaultSaveFormat = 51
ActiveSheet.Copy
Set Builders_Risk = ActiveWorkbook
BR_Reporting.CheckCompatibility = False
'Stops error display at time of file save
Application.DisplayAlerts = False
With BR_Reporting
.SaveAs tempFilePath & tempFileName & ".xlsx", FileFormat:=51
.Close SaveChanges:=False
End With
'Reinstates error displays after save
Application.DisplayAlerts = True
'Set DefaultSaveFormat back to the users setting
Application.DefaultSaveFormat = SaveFormat
End Sub