Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Hello all
Is there any way to check if a file is already open by another user before trying to open it. If "Filename is open" = true then abort procedure else Workbooks.Open Filename.... end if Thanks |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Try this function:
Function FileIsOpen(strFile As String) As Boolean Dim hFile As Long On Error GoTo OpenError hFile = FreeFile Open strFile For Input Lock Read As #hFile Close #hFile Exit Function OpenError: FileIsOpen = Err.Number = 70 End Function RBS "Cresta" wrote in message ... Hello all Is there any way to check if a file is already open by another user before trying to open it. If "Filename is open" = true then abort procedure else Workbooks.Open Filename.... end if Thanks |
#3
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Thanks
That worked a treat "RB Smissaert" wrote: Try this function: Function FileIsOpen(strFile As String) As Boolean Dim hFile As Long On Error GoTo OpenError hFile = FreeFile Open strFile For Input Lock Read As #hFile Close #hFile Exit Function OpenError: FileIsOpen = Err.Number = 70 End Function RBS "Cresta" wrote in message ... Hello all Is there any way to check if a file is already open by another user before trying to open it. If "Filename is open" = true then abort procedure else Workbooks.Open Filename.... end if Thanks |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Check if mdb file is open | Excel Programming | |||
check if file is already open | Excel Discussion (Misc queries) | |||
Check to see if a file is already open | Excel Programming | |||
check if a file is open | Excel Programming | |||
check if file already is open | Excel Programming |