Hi,
I have a macro that, based on cell values; creates a new folder, saves the ActiveWorkbook as a new file name in the new folder, copies the contents of the old folder to the new folder (except the old workbook), and deletes the old folder.

The problem I'm running in to is sometimes there is another file open that is located in the same folder (or occasionally a sub folder), which then causes the macro to crash because you can't copy or move an open file.

What I need to do is add some code to the existing macro that will check and see if any other files in ThisWorkbook.Path (besides the ActiveWorkbook) are open.

Let's say the ActiveWorkbook is located in the following folder:

C:\DIRECTORY_1\DIRECTORY_2\DIRECTORY_3\DIRECTORY_4\DIRECTORY_5\WORKBOOK_LOCATION

The check would need to accommodate any file type, but typically the folder contents would include xls, doc, pdf, and jpg.

Also, occasionally there is a folder(s) in ThisWorkbook.Path as well, so it would probably be a good idea to check those folders (and any sub folders) as well.




Ideally, this would be an IF statement, something like:

If another file is open in addition to ThisWorkbook Then
Msgbox"There is another file open, the macro will stop."
Exit Sub
Else
'<PROCEED WITH MACRO>
End If
I'm sure this isn't an overly difficult thing to do, I'm just not sure how to go about it.

Thanks for the help!