ExpireDate 属性

       

返回一个 Variant 类型,表示对应于 Signature 对象的数字签名的过期日期。只读。

expression.ExpireDate

expression   必需。该表达式返回“应用于”列表中的对象之一。

示例

本示例提示用户选择 Microsoft Word 中活动文档的数字签名。要使用本示例,请在 Word 中打开文档并调用该函数。该函数将进行测试以确保用户所选择的数字签名在 12 个月内不会过期。如果将会过期,则不附加证书。

Function AddSignature() As Boolean

    On Error GoTo Error_Handler

    Dim sig As Signature

    'Display the dialog box that lets the
    'user select a digital signature.
    'If the user selects a signature, then
    'it is added to the Signatures
    'collection. If the user doesn't, then
    'an error is returned.
    Set sig = ActiveDocument.Signatures.Add

    'Test to make sure that the new Signature object
    'doesn't expire too soon. This expression calculates
    'the number of months until the Signature object expires.
    If DateDiff("m", sig.SignDate, sig.ExpireDate) < 12 Then

        MsgBox "This Certificate will expire in less than 1 year." & vbCrLf & _
        "Please use a newer certificate."

        AddSignature = False
        sig.Delete
    Else
        AddSignature = True
    End If

    'Commit all signatures in the SignatureSet collection to the disk.
    ActiveDocument.Signatures.Commit

    Exit Function
Error_Handler:
    AddSignature = False
    MsgBox "Action cancelled."
End Function