ModifiedBy Property

Microsoft Office Visual Basic

Show All Show All

ModifiedBy Property

ShowAs it applies to the DocumentLibraryVersion object.

Returns the name of the user who last saved the specified version of the shared document to the server. Read-only String.

expression.ModifiedBy

expression    Required. An expression that returns a DocumentLibraryVersion object.

ShowAs it applies to the SharedWorkspaceFile, SharedWorkspaceLink, and SharedWorkspaceTask objects.

Returns the name of the user who last modified the object. Read-only String.

expression.ModifiedBy

expression    Required. An expression that returns a SharedWorkspaceFile, SharedWorkspaceLink, or SharedWorkspaceTask object.

Remarks

For shared workspace objects, the ModifiedBy property returns the friendly name stored in the Name property of the DWSMember object.

The SharedWorkspaceFolder and SharedWorkspaceMember objects do not have a ModifiedBy property.

Example

As it applies to the DocumentLibraryVersion object.

The following example displays the ModifiedBy name along with other properties of each version of a shared document.

            Dim dlvVersions As Office.DocumentLibraryVersions
    Dim dlvVersion As Office.DocumentLibraryVersion
    Dim strVersionInfo As String
    Set dlvVersions = ActiveDocument.DocumentLibraryVersions
    If dlvVersions.IsVersioningEnabled Then
        strVersionInfo = "This document has " & _
            dlvVersions.Count & " versions: " & vbCrLf
        For Each dlvVersion In dlvVersions
            strVersionInfo = strVersionInfo & _
                " - Version #: " & dlvVersion.Index & vbCrLf & _
                "  - Modified by: " & dlvVersion.ModifiedBy & vbCrLf & _
                "  - Modified on: " & dlvVersion.Modified & vbCrLf & _
                "  - Comments: " & dlvVersion.Comments & vbCrLf
        Next
    Else
        strVersionInfo = "Versioning not enabled for this document."
    End If
    MsgBox strVersionInfo, vbInformation + vbOKOnly, "Version Information"
    Set dlvVersion = Nothing
    Set dlvVersions = Nothing
      

As it applies to the SharedWorkspaceFile, SharedWorkspaceLink, and SharedWorkspaceTask objects.

The following example lists the files in a shared workspace that were last modified by users other than the creator of the workspace.

            Dim swsFile As Office.SharedWorkspaceFile
    Dim swsOwner As Office.SharedWorkspaceMember
    Dim strMemberFiles As String
    Set swsOwner = ActiveWorkbook.SharedWorkspace.Members(1)
    For Each swsFile In ActiveWorkbook.SharedWorkspace.Files
        If swsFile.ModifiedBy <> swsOwner.Name Then
            strMemberFiles = strMemberFiles & swsFile.URL & vbCrLf
        End If
    Next
    MsgBox "These files were last modified by other users:" & _
        vbCrLf & strMemberFiles, _
        vbInformation + vbOKOnly, "Files Modified by Other Users"
    Set swsOwner = Nothing
    Set swsFile = Nothing