Shared FOLDER in Use

samuel.nunn

New Member
Joined
Feb 22, 2009
Messages
20
I have seen some macros that can tell you if a shared FILE is in use by another user, but is there a way for the macro to tell me if a ANY file on a shared folder is in use. I don't really need to know the name of the file, just that SOME file on that folder is in use.

Here is the code for a shared FILE (as given by Microsoft). I just need it for a FOLDER.



Code:
 Sub TestFileOpened()

       ' Test to see if the file is open.
       If IsFileOpen("c:\Book2.xls") Then
           ' Display a message stating the file in use.
           MsgBox "File already in use!"
           '
           ' Add code here to handle case where file is open by another
           ' user.
           '
       Else
           ' Display a message stating the file is not in use.
           MsgBox "File not in use!"
           ' Open the file in Microsoft Excel.
           Workbooks.Open "c:\Book2.xls"
           '
           ' Add code here to handle case where file is NOT open by
           ' another user.
           '
       End If
   End Sub
</pre>
 

Some videos you may like

Excel Facts

What is the fastest way to copy a formula?
If A2:A50000 contain data. Enter a formula in B2. Select B2. Double-click the Fill Handle and Excel will shoot the formula down to B50000.

Jaafar Tribak

Well-known Member
Joined
Dec 5, 2002
Messages
8,062
Office Version
  1. 2016
Platform
  1. Windows
Hi,

How about iterating trough all the files in the shared folder and checking if they are open via the same IsFileOpen Function ?

Regards.
 
Last edited:

Watch MrExcel Video

Forum statistics

Threads
1,118,168
Messages
5,570,621
Members
412,333
Latest member
hectamuptra
Top