我使用VBA时,我要保存Excel工作簿我的桌面文件夹中得到一个Runtime error 1004 document not saved
。以下是我的代码的详细信息:运行时错误1004文档没有保存使用VBA的Excel 2016
Private Sub Save_Click()
'Popup the Window "Save As"
Application.DisplayAlerts = False
MsgBox "Do not change the default file name proposed on the next step please !"
Dim fName As Variant
Dim DName As String ' Variable storing name of excel workbook which has to be saved
DName = UserForm.CustomerApplication.Value & " - " & UserForm.L2GType.Value
& " - " & UserForm.Title.Value & " - " & UserForm.Country.Value & "(" &
Year(Date) & ")"
fName = Application.GetSaveAsFilename(InitialFileName:=DName, _
FileFilter:="Excel Files (*.XLSX), *.XLSX", Title:="Save As")
If fName = False Then
Exit Sub
ActiveWorkbook.SaveAs filename:=fName, FileFormat:=51
ActiveWorkbook.Close
End Sub
你们可以请我帮忙,因为我在这部分代码中得到了错误ActiveWorkbook.SaveAs文件名:= fName,FileFormat:= 51 – Tabraiz
您是否测试过下面提供的解决方案?任何反馈将是不错的... –