OaklandJim
Well-known Member
- Joined
- Nov 29, 2018
- Messages
- 855
- Office Version
- 365
- Platform
- Windows
I have a sub that for starters merely looks to see whether a folder exists using simple "FolderExists" function below. After doing that the folder and subfolders are "locked." Excel gives file/path access error and windows sez file in use if try to do anything to the folder. How do I free up the folder and its contents after doing this?
VBA Code:
Function FolderExists(FolderPath As String) As Boolean
FolderExists = True
On Error Resume Next
ChDir FolderPath
If Err <> 0 Then FolderExists = False
On Error GoTo 0
End Function