[英]Excel VBA save file automatic to xlsx and delete xlsm -> error 70
My file.xlsm has some code.我的 file.xlsm 有一些代码。 After first time opening it has to save the file to.xlsx and delete the.xlsm
第一次打开后必须将文件保存到.xlsx并删除.xlsm
I have the following code:我有以下代码:
Sub OpslaanAls()
Dim Filenamepath As String, FilenamepathNew as String
Application.DisplayAlerts = False
Filenamepath = ActiveWorkbook.FullName
FilenamepathNew = Replace(Filenamepath, ".xlsm", ".xlsx")
Application.DisplayAlerts = False
ThisWorkbook.SaveAs FilenamepathNew, 51 '51 = xlsx
Application.DisplayAlerts = True
Kill Filenamepath 'verwijder de xlsm
End Sub
The saveas
part works fine. saveas
部分工作正常。 But the kill gives me an error 70但是kill给我一个错误70
why?为什么?
Try deleting the file from command line, using a batch file尝试使用批处理文件从命令行删除文件
Open "batch_file.bat" for output as #1 'create batch file
Print #1, "del " & Filenamepath 'store the delete file command
close #1
Shell "batch_file.bat" 'execute the batch file
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.