View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
ajliaks[_46_] ajliaks[_46_] is offline
external usenet poster
 
Posts: 1
Default Wrkbk already open by whom?


Hi friends,

As some one told me here, Iam using "Error manipulation" to know whe
an specific workBk is already open, and works cool.

Question: Is there any way to know the Loggin name of the user usin
that workBk?

Thanks in advance,
Aldo.

This is the code to know if the file is already open:

Function CheckOrFileOpen(strFilename As String)
'This function checks to see if a file is open or not.
Dim intFile As Integer, intErrorNummer As Integer
On Error Resume Next
intFile = FreeFile()
' Attempt to open the file and lock it.
Open strFilename For Input Lock Read As #intFile
Close intFile
intErrorNummer = Err.Number
On Error GoTo 0
'Check to see which error occurred.
Select Case intErrorNummer
Case 0
CheckOrFileOpen = False
Case 70
CheckOrFileOpen = True
Case Else
Error intErrorNummer
End Select
End Functio

--
ajliak
-----------------------------------------------------------------------
ajliaks's Profile: http://www.excelforum.com/member.php...nfo&userid=819
View this thread: http://www.excelforum.com/showthread.php?threadid=39805