Hi I want to check if a files are in use over the network.
When I open the workbook it says that the file is in use, and i can open as read only but this is time consuming.
Is there any code to check if the file is in use?
Thanks
Steve
I have tried the following code but I think it only works for the PC i am currently using.
When I open the workbook it says that the file is in use, and i can open as read only but this is time consuming.
Is there any code to check if the file is in use?
Thanks
Steve
I have tried the following code but I think it only works for the PC i am currently using.
Code:
Private Function WorkbookIsOpen(wbname) As Boolean
' Returns TRUE if the workbook is open
Dim wb As Workbook
On Error Resume Next
Set wb = Workbooks(wbname)
If Err = 0 Then
WorkbookIsOpen = True
Else
WorkbookIsOpen = False
End If
End Function
Sub TestWBOpen()
Dim wbname As String
wbname= "='x:\camera diagnostics\cameracomport.xls"
If wbname.open = true Then
MsgBox "Workbook " & wbname & " is open"
Else
MsgBox "The workbook is NOT open"
End If
End Sub