sharky12345
Well-known Member
- Joined
- Aug 5, 2010
- Messages
- 3,422
- Office Version
- 2016
- Platform
- Windows
I'm randomly getting an error 70, Permission Denied when I try to execute the following routine;
I don't know which line it is failing on because it fails when the routine itself is called from the Workbook Close event.
The odd thing is that sometimes it works with no errors at all.
Can anyone offer advice?
Code:
Sub DeleteFiles()
'Raw Data
If FileFolderExists(ThisWorkbook.Path & "\Toolbox Files\System Files\Raw Data*.xlsx") Then
Kill ThisWorkbook.Path & "\Toolbox Files\System Files\Raw Data*.xlsx"
End If
'Handover Documents
If FileFolderExists(ThisWorkbook.Path & "\Toolbox Files\System Files\Handover*.pdf") Then
Kill ThisWorkbook.Path & "\Toolbox Files\System Files\Handover*.pdf"
End If
End Sub
I don't know which line it is failing on because it fails when the routine itself is called from the Workbook Close event.
The odd thing is that sometimes it works with no errors at all.
Can anyone offer advice?