Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Is FIle Open
We have a .xls file on a server. Is there any way to determine if another
user has the file open before trying to open it myself? -- Gary's Student gsnu200706 |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
Is FIle Open
Function IsFileOpen(FileName As String) Dim iFilenum As Long Dim iErr As Long On Error Resume Next iFilenum = FreeFile() Open FileName For Input Lock Read As #iFilenum Close iFilenum iErr = Err On Error GoTo 0 Select Case iErr Case 0: IsFileOpen = False Case 70: IsFileOpen = True Case Else: Error iErr End Select End Function Sub test() If Not IsFileOpen("C:\MyTest\volker2.xls") Then Workbooks.Open "C:\MyTest\volker2.xls" End If End Sub -- HTH Bob Phillips (there's no email, no snail mail, but somewhere should be gmail in my addy) "Gary''s Student" wrote in message ... We have a .xls file on a server. Is there any way to determine if another user has the file open before trying to open it myself? -- Gary's Student gsnu200706 |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
Is FIle Open
Thank you
-- Gary's Student gsnu200705 "Bob Phillips" wrote: Function IsFileOpen(FileName As String) Dim iFilenum As Long Dim iErr As Long On Error Resume Next iFilenum = FreeFile() Open FileName For Input Lock Read As #iFilenum Close iFilenum iErr = Err On Error GoTo 0 Select Case iErr Case 0: IsFileOpen = False Case 70: IsFileOpen = True Case Else: Error iErr End Select End Function Sub test() If Not IsFileOpen("C:\MyTest\volker2.xls") Then Workbooks.Open "C:\MyTest\volker2.xls" End If End Sub -- HTH Bob Phillips (there's no email, no snail mail, but somewhere should be gmail in my addy) "Gary''s Student" wrote in message ... We have a .xls file on a server. Is there any way to determine if another user has the file open before trying to open it myself? -- Gary's Student gsnu200706 |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Unable to open a 82 KB XLSM file due to "Too many different cellformats" & "Converter failed to open the file." errors. | Excel Discussion (Misc queries) | |||
In Excel - Use Windows Explorer instead of File Open to open file | Excel Discussion (Misc queries) | |||
Open a file do a macro ( made) and open next succesive file | Excel Programming | |||
Open File or Switch Between Windows if File is Open | Excel Programming | |||
Open File or Switch Between Windows if File is Open | Excel Programming |