Excel VBA脚本使用button保存

我试图创build一个button,将Excel电子表格保存为非macros的xlsx文件。 我是VBS新手,很自豪,我有一个button,在顶部添加一行,并保持格式化,但这个保存button正在驱使我疯狂。 这个脚本也允许用户select他们想要保存文件的位置吗? 我也需要这个function。 以下是我一直在网上搜刮网站的内容:

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