Propiedad SignDate

Microsoft Office Objects

Propiedad SignDate

       

Devuelve una variable Variant que representa la fecha y la hora en que se ha adjuntado al documento el certificado digital correspondiente al objeto Signature. Es de sólo lectura.

expresión.SignDate

expresión   Requerida. Expresión que devuelve uno de los objetos de la lista Aplicar a.

Ejemplo

En el ejemplo siguiente se solicita al usuario que seleccione una firma digital para firmar el documento activo de Microsoft Word. Para utilizar este ejemplo, abra un documento en Word y ejecute esta función. La función realizará la comprobación para asegurarse de que la firma digital que selecciona el usuario no caduca antes de 12 meses. Si caduca, no se adjunta el certificado.

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