ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Is workbook open on the network? (https://www.excelbanter.com/excel-programming/305407-workbook-open-network.html)

ianripping[_85_]

Is workbook open on the network?
 
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

--
Message posted from http://www.ExcelForum.com


Andy Wiggins

Is workbook open on the network?
 
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"



"ianripping " wrote in message
...
I have a LAN network. I want a command that says if the workbook is
open on another PC by another user then msgbox("Already open") else
open it as normal.

Any ideas?


---
Message posted from http://www.ExcelForum.com/




ianripping[_86_]

Is workbook open on the network?
 
Yes, but instead of that message appearing, I want it to just not ope
then workbook

--
Message posted from http://www.ExcelForum.com


Michel Pierron[_2_]

Is workbook open on the network?
 
Hi ianripping,
You can use:
Private Sub Workbook_Open()
If ThisWorkbook.ReadOnly Then ThisWorkbook.Close False
End Sub

MP

"ianripping " a écrit dans le message
de ...
I have a LAN network. I want a command that says if the workbook is
open on another PC by another user then msgbox("Already open") else
open it as normal.

Any ideas?


---
Message posted from http://www.ExcelForum.com/




Bob Phillips[_6_]

Is workbook open on the network?
 
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)

"ianripping " wrote in message
...
Yes, but instead of that message appearing, I want it to just not open
then workbook.


---
Message posted from http://www.ExcelForum.com/




ianripping[_87_]

Is workbook open on the network?
 
Ok, Michelle yours doesnt work. Bob - how do I use yours?


---
Message posted from http://www.ExcelForum.com/


ianripping[_88_]

Is workbook open on the network?
 
Ok, Michelle yours doesnt work. Bob - how do I use yours

--
Message posted from http://www.ExcelForum.com


ianripping[_89_]

Is workbook open on the network?
 
Michell I got yours to work.

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

--
Message posted from http://www.ExcelForum.com



All times are GMT +1. The time now is 07:30 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com