ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Wrkbk already open by whom? (https://www.excelbanter.com/excel-programming/338020-wrkbk-already-open-whom.html)

ajliaks[_46_]

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



All times are GMT +1. The time now is 01:52 PM.

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