Found a partial answer to my quesiton, I can search for the ~$ file which is created in the same folder by Windows when it is open by an other user
http://stackoverflow.com/questions/15555...7#16820357
Unfortunatly the part won't work since QTP can't execute any WScript.
Would anyone have an alternative for WshShell.Echo in order to notify the user using the file ?
Thanks a lot
http://stackoverflow.com/questions/15555...7#16820357
Code:
testWorkbookLockFile = "path\~$file.xlsx"
Set objFSO = CreateObject("Scripting.FileSystemObject")
If objFSO.FileExists(testWorkbookLockFile) Then
(testWorkbookLockFile)
WshShell.Echo "The file is locked by " & GetFileOwner(testWorkbookLockFile)
Else
WScript.Echo "The file is available"
End If
Function GetFileOwner(strFileName)
' http://www.vbsedit.com/scripts/security/ownership/scr_1386.asp
Set objWMIService = GetObject("winmgmts:")
Set objFileSecuritySettings = _
objWMIService.Get("Win32_LogicalFileSecuritySetting='" & strFileName & "'")
intRetVal = objFileSecuritySettings.GetSecurityDescriptor(objSD)
If intRetVal = 0 Then
GetFileOwner = objSD.Owner.Name
Else
GetFileOwner = "Unknown"
End If
End FunctionUnfortunatly the
Code:
WshShell.Echo "The file is locked by " & GetFileOwner(testWorkbookLockFile)Would anyone have an alternative for WshShell.Echo in order to notify the user using the file ?
Thanks a lot

