Is workbook open on the network?

  • Thread starter Thread starter ianripping
  • Start date Start date
I

ianripping

I have a LAN network. I want a command that says if the workbook i
open on another PC by another user then msgbox("Already open") els
open it as normal.

Any ideas
 
It's already part of the kit Uncle Bill supplies. If the workbook isn't open
elsewhere it will open as normal. If someone else has it open a warning
dialog will open allowing the user to open it as read-only, be notified when
it's available or not to open it.

--
Regards
Andy Wiggins
www.BygSoftware.com
Home of "Save and BackUp",
"The Excel Auditor" and "Byg Tools for VBA"
 
Yes, but instead of that message appearing, I want it to just not ope
then workbook
 
Hi ianripping,
You can use:
Private Sub Workbook_Open()
If ThisWorkbook.ReadOnly Then ThisWorkbook.Close False
End Sub

MP
 
Ian,

This function will test it, but it does open it to find out

Function IsNetworkOpen(filename As String)
Dim nFile As Long

IsNetworkOpen = False

nFile = FreeFile()
On Error Resume Next
Open filename For Input Lock Read Write As #nFile
If Err <> 0 Then
If Err.Number = 70 Then
IsNetworkOpen = True
Else
IsNetworkOpen = "No such file"
End If
End If
On Error GoTo 0
Close #nFile

End Function



--

HTH

Bob Phillips
... looking out across Poole Harbour to the Purbecks
(remove nothere from the email address if mailing direct)
 
Michell I got yours to work.

Is there any way of reporting the network pc where the file is open
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top