In VBS, to handle errors you'll need to use On Error Resume Next
.
On Error Resume Next
Do something that can fail
If you want to actually do some processing on error then you'll need to use a label.
On Error Resume HandleError
Do something that can fail
HandleError:
Do something in case of failure
Resume Next
For deleting files that may be in use note that if you attempt to delete the entire folder then it'll fail but some files may already be deleted. If you want to delete as many files as you can then you'll need to enumerate the files instead (including their subfolders). For that you'll need to walk all the child folders in the parent folder and then enumerate all the files in each child folder (and they can recursive indefinitely). For each file try to delete it. If a folder is empty then you can remove the folder itself otherwise the folder remains and you move on to the next folder.
Here's a link to a Stack Overflow post where a person has provided that code. They even seem to have the error handling code in place although I don't know if you need the calls to Echo yourself.