Objeto Signature

Corresponde a una firma digital que se adjunta a un documento. Los objetos Signature se incluyen en la colección SignatureSet del objeto Document.
Utilizar el objeto Signature
Puede utilizar un objeto Signature para una colección SignatureSet utilizando el método Add y devolver un miembro existente utilizando el método Item. Para quitar un objeto Signature de una colección SignatureSet, utilice el método Delete del objeto Signature.
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 de Word y pase a esta función los nombres de un emisor y de un firmante de certificados en los campos Emitido por y Emitido para de un certificado digital, en el cuadro de diálogo Certificados digitales. Este ejemplo comprueba que la firma digital que el usuario selecciona cumple ciertos criterios, como no haber caducado, antes de que se guarde la firma nueva en el disco.
Function AddSignature(ByVal strIssuer As String, _
strSigner As String) 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 several properties before commiting the Signature object to disk.
If sig.Issuer = strIssuer And _
sig.Signer = strSigner And _
sig.IsCertificateExpired = False And _
sig.IsCertificateRevoked = False And _
sig.IsValid = True Then
MsgBox "Signed"
AddSignature = True
'Otherwise, remove the Signature object from the SignatureSet collection.
Else
sig.Delete
MsgBox "Not signed"
AddSignature = False
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