ExpirationDate Property

Microsoft Office Visual Basic

ExpirationDate Property

Returns or sets the optional expiration date of the permissions on the active document assigned to the user associated with the specified UserPermission object. Read/write Variant.

expression.ExpirationDate

expression    Required. An expression that returns a UserPermission object.

Remarks

The UserPermission object associates a set of permissions on the active document with a single user and an optional expiration date. The ExpirationDate property returns or sets the optional expiration date of the specified UserPermission object using the local time zone.

Example

The following example extends the expiration date of the second user's permissions on the active document by an additional six months.

        Dim irmPermission As Office.Permission
    Dim irmUserPerm As Office.UserPermission
    Dim dtmOldDate As Date, dtmNewDate As Date
    Set irmPermission = ActiveWorkbook.Permission
    Set irmUserPerm = irmPermission.Item(2)
    dtmOldDate = irmUserPerm.ExpirationDate
    dtmNewDate = DateAdd("m", 6, dtmOldDate)
    irmUserPerm.ExpirationDate = dtmNewDate
    MsgBox "Permissions expiration for " & irmUserPerm.UserId & vbCrLf & _
        "extended from " & dtmOldDate & " to " & dtmNewDate, _
        vbInformation + vbOKOnly, "IRM Information"
    Set irmUserPerm = Nothing
    Set irmPermission = Nothing