tiredofit
Well-known Member
- Joined
- Apr 11, 2013
- Messages
- 1,924
- Office Version
- 365
- 2019
- Platform
- Windows
I want to use the cmd /c del command to delete a file, instead of Kill.
This works:
but if the filename contains a space like this, it fails
How can I make it work when the filename contains spaces?
Thanks
This works:
Code:
Dim Loc As String
Loc = "C:\MyFolder\abcdef.xlsm"
Dim cmd As String
cmd = "cmd /c del " & Loc
Shell cmd
but if the filename contains a space like this, it fails
Code:
Dim Loc As String
Loc = "C:\MyFolder\abcde f.xlsm"
Dim cmd As String
cmd = "cmd /c del " & Loc
Shell cmd
How can I make it work when the filename contains spaces?
Thanks