Sub save() Dim str As String Dim ws As Worksheet Application.ScreenUpdating = False Application.DisplayAlerts = False str = Application.InputBox(prompt:="请输入想要保存的文件名", Type:=2) If str = "" Then Exit Sub End If Set ws = ActiveSheet ws.SaveAs Filename:=str, FileFormat:=xlExcel8 ActiveWindow.Close Application.ScreenUpdating = True Application.DisplayAlerts = True End Sub ****PS:在输入想要保存的文件名的时候,可以以这种格式输入D:文件名.xls就可以改变文件名和保存路径