我正在运行以下脚本,它似乎没有关闭并且脚本运行时的文件。如何编辑脚本以便它可以关闭脚本。
Sub LoopFiles()
Dim MyFileName As String, MyPath As String
Application.ScreenUpdating = False
Application.DisplayAlerts = False
MyPath = "C:\macro\"
MyFileName = Dir(MyPath & "*.xlsx")
ChDir "C:\macro\csv"
Do Until MyFileName = ""
Workbooks.Open Filename:=MyPath & MyFileName
ActiveWorkbook.SaveAs Filename:=Left(MyFileName, InStr(1, MyFileName, ".xlsx") - 1), FileFormat:=xlCSV, CreateBackup:=False
MyFileName = Dir
Loop
Application.ScreenUpdating = True
Application.DisplayAlerts = True
End Sub