Hello

Is there No straight and simple method to get the owner of a file from VBA. say for example I have a file in

G:\OUTPUT\New folder (2)\test.xlsx. (G is share drive)



************
I found this googling, however gives me error while executing and this is not exactly iam looking


Sub owner()
Dim Folder As String
Dim FName As String

Folder = "c:\temp\"
RowCount = 1
FName = Dir(Folder & "*.*")

Do While FName <> ""
   Range("A" & RowCount) = Folder & FName
   Range("B" & RowCount) = GetFileOwner(Folder, FName)
   
   RowCount = RowCount + 1
   FName = Dir()
Loop

End Sub

Function GetFileOwner(fileDir As String, fileName As String) As String

 'On Error Resume Next
 Dim secUtil As Object
 Dim secDesc As Object
 Set secUtil = CreateObject("ADsSecurityUtility")
 Set secDesc = secUtil.GetSecurityDescriptor(fileDir & fileName, 1, 1)
 GetFileOwner = secDesc.owner
End Function
regrds
var