Anyway to check if file is not open?

Hi,

in my application, i need to delete a pdf file that i create earlier.

Is there anyway i can check if it is open by some other program and give a nice error message??

TRY/CATCH perhaps?

Delete first and then check for an error:

pdfFile.Delete If pdfFile.LastErrorCode <> 0 Then MsgBox("Could not delete file. Perhaps it is in use.") // Code 104 End If

Or just move it to trash, so it doesn’t matter if it’s open.

On window? I already have the code to do delete or move to trash on mac