ExcelBanter

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

Spencer Hutton

Is workbook open on network drive
 
Is there a way to tell if a workbook is open on a network drive? If someone
has this workbook open, there name will be in sheet1 range A1.

Is there a statement that can tell me 1. if the workbook is open and 2. the
name of the person who has it open (range A1)?

i have played with referring to it as such, but am not sure of the rest of
the code i should use.

workbooks("\\servername\folder name\file name.xls")

Dick Kusleika[_4_]

Is workbook open on network drive
 
On Tue, 18 Mar 2008 07:16:00 -0700, Spencer Hutton
wrote:

Is there a way to tell if a workbook is open on a network drive? If someone
has this workbook open, there name will be in sheet1 range A1.

Is there a statement that can tell me 1. if the workbook is open and 2. the
name of the person who has it open (range A1)?

i have played with referring to it as such, but am not sure of the rest of
the code i should use.

workbooks("\\servername\folder name\file name.xls")


Open on your machine? This won't account for mapped drives, but it may give
you a start

Dim wb As Workbook

On Error Resume Next
Set wb = Workbooks("BackOrderReport.xls")
On Error GoTo 0

If wb Is Nothing Then
MsgBox "Workbook not open"
Else
If Left$(wb.Path, 2) = "\\" Then
MsgBox "Workbook open on network drive by " &
wb.Sheets(1).Range("a1").Value
Else
MsgBox "Workbook open locally"
End If
End If
--
Dick Kusleika
Microsoft MVP-Excel
http://www.dailydoseofexcel.com


All times are GMT +1. The time now is 12:13 PM.

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