Hi

I had a requirement of creating a windows Folder within the Excel VBA program if its not present and used below code which actually do create the folder as expected. I am also creating excel and text files in this folder.
But I Cannot Physically Delete the Folder after Use its giving me an error as below.
Can someone provide me a way to handle this by may be Closing the folder within the code. please note that the excel/text files created within the new FOlder can be deleted without any issues

For ex: On running the VBA program, i am checking whether a folder location C:\Test\data is present or else it creates folder C:\Test\data
While I go to explorer and delete this Created folder, its throwing me the error

Code used for creating the FOlder

sploc = Cells(1, 8).Value
queryloc = sploc & "\data"
If Len(Dir(queryloc, vbDirectory)) = 0 Then
MkDir queryloc
End If


delete screen.jpg

Thnx in advance
UK