2022年4月15日 星期五

vba 刪除檔案方法不愛 KILL

懶人用法kill :

語法很簡單就是 KILL +檔案路徑+完整檔案名稱

但缺點是有時候會有一點BUG,如字串長度限制

非懶人法(Scripting.FileSystemObject):

Set fs = CreateObject("Scripting.FileSystemObject")

With New FileSystemObject '宣導一個新的物件
'FILEPath 要刪除的路徑+完整檔案名稱

    If fs.FileExists(FILEPath ) Then 

        fs.DeleteFile FILEPath 

    End If

End With



沒有留言:

張貼留言

上市櫃營收年增率:202604

月年增率 115.04 上市櫃公司總營收與月年增率 月總營收 113/01 113/02 113/03 113/04 113/05 113/06 113/07 113/08 113/09 113/10 113/11 113/12 114/01 114/02 114/03 114/...