0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

Posted at

Function NormalizePath(path As String) As String
Dim fs As Object
Set fs = CreateObject("Scripting.FileSystemObject")
If fs.FileExists(path) Then
NormalizePath = fs.GetAbsolutePathName(path)
Else
NormalizePath = ""
End If
End Function

Sub TestKill()
Dim filePath As String
filePath = "C:\Users\username\Desktop\データ.txt"

filePath = NormalizePath(filePath) ' 正規化して取得
If filePath <> "" Then
    Kill filePath
    MsgBox "削除成功: " & filePath
Else
    MsgBox "削除失敗: パスが見つからない"
End If

End Sub

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?