Wer hat file ausgecheckt
Fettertiger
mit untenstehendem Makro öffne ich eine Datei auf einem Sharepoint und checke die Datei aus. Das Makro funktioniert soweit auch ganz gut.
Was ich jetzt nur noch brauche ist, dass mir der Username der Person (DerChecker=....) angezeigt wird die das File gerade ausgecheckt hat.
Sub Shareppointfilemanually()
Dim userpath As String
dim xw as workbook
userpath = mysharepoint
SFilename = "testfile.xlsb"
For Each xw In Application.Workbooks
If xw.Name = SFilename Then
Exit For
End If
Next xw
If xw Is Nothing Then
On Error Resume Next
Application.EnableEvents = False
If Workbooks.CanCheckOut(userpath & SFilename) = True Then
Workbooks.CheckOut userpath & SFilename
CheckedOut = True
Else
DerChecker = ?
MsgBox (SFilename & " is already checked out by User " & DerChecker)
Exit Sub
End If
Workbooks.Open Filename:= userpath & SFilename, ReadOnly:=False
If Err.Number = 1004 Then 'file could not be found
Set xw = Nothing
Exit Sub
Else: Set xw =activeWorkbook
End If
End If
xw.Activate
Set xw = Nothing
End Sub
Hat jemand eine Idee wie man das bestimmen kann?Danke für Eure Hilfe
Gruss
Theo