有人可以帮我修复下面的代码,因为它已保存,但我无法打开该文件,因为它说该文件可能已损坏。可能我在这里做错了。请注意,该文件以CSV格式接收,需要保存为常规Excel文件。
Sub SaveAsToFolderPath()
Dim MyFileName As String
Dim folderPath As String
Dim dateFormat As String
folderPath = "C:\Users\A\Desktop\M work\DFMS\"
dateFormat = Format(Now, "dd.mm.yyyy HH-mm-ss AMPM")
MyFileName = Range("G2").Value
If Not ActiveWorkbook.Saved Then
ActiveWorkbook.SaveAs Filename:=folderPath & MyFileName & " - Next Delivery " & dateFormat & ".xlsm"
End If
End Sub
答案 0 :(得分:2)