none
Installation of a trust certificate on client computer, and a couple other questions. RRS feed

  • Question

  • Hi everyone - I have developed a document for interaction between our sales team and clients but I want to make the process of installing our certificate easier on both sides before I release it.

    On the Sales side, I need to program our certificate to sign the proposals when they click the "Save As New Proposal" Button.  Currently the script for that button just checks the fields and then deletes the extra buttons that are no longer needed once a proposal is finished, then saves it as a *.docm file.  I haven't found any documentation about how to automatically sign but I can't imagine that Microsoft would leave such a critical function out of VBA...

    Also - it seems that my save as script for the button isn't working correctly either.  It goes through everything alright but the file doesn't actually "SAVE".  I had missed the first lecture that I had on File I/O so I am assuming it's a silly mistake.  My script for this is as follows:

            With Application.Dialogs(wdDialogFileSaveAs)
                .Format = 13
                .Show
            End With

    On the Client side, I want the certificate to install the way that a web trust certificate installs...  one button.  I don't want them to have to navigate through to install it because not all our clients are completely comfortable with their computer skills, so I want it to be quick.  Currently they first get the big warning about Macro's and activeX controls with the automatic function to "help protect me", and an OK button, and in order to install the certificate they have to click the small link to it that is very easy to pass over.  That takes you to the certificate details, then you need to click the button to view the certificate, then you need to install it.  Then after all that, it doesn't even work correctly.  I didn't learn certificates in school, I don't know if I need to purchase a different type of certificate, all I have for this is a digital signing.  Ideally the certificate would allow all macros to run and trust access to VBA.

    Thanks in advance for your help.

    Monday, April 23, 2012 6:24 PM

Answers

  • To answer your question in summary I would check out some of the articles and examples listed below , I think they sure can help get you going. I have also listed some properties and methods that may be useful in your project.

    Document.Signatures Property

    Document.VBASigned Property (Word)

    Signature Object (Office)

    Example:

    'WARNING: ANY USE BY YOU OF THE CODE PROVIDED IN THIS EXAMPLE IS

    'AT YOUR OWN RISK. Microsoft provides this macro code "as is" without warranty of

    'any kind, either express or implied, including but not limited to the implied warranties of

    'merchantability and/or fitness for a particular purpose.

    The following example prompts the user to select a digital signature with which to sign the active document in Microsoft Word. To use this example, open a document in Word and pass this function the name of a certificate issuer and the name of a certificate signer that match the Issued By and Issued To fields of a digital certificate in the Digital Certificates dialog box. This example will test to make sure that the digital signature that the user selects meets certain criteria, such as not having expired, before the new signature is committed to the disk.

    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 does not, 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 canceled."

    End Function

    Below are some links that you probably want to read prior to working on your project as they clarify  a lot of things with signatures and certificates.

    Digital signatures and certificates

    http://office.microsoft.com/en-us/excel-help/digital-signatures-and-certificates-HA010354667.aspx

    Digitally sign your macro project

    http://office.microsoft.com/en-us/excel-help/digitally-sign-your-macro-project-HA010354312.aspx

    Add or remove a digital signature in Office files

    http://office.microsoft.com/en-us/excel-help/add-or-remove-a-digital-signature-in-office-files-HA010354308.aspx

    Plan digital signature settings for Office 2010

    http://technet.microsoft.com/en-us/library/cc545900.aspx

    Understanding Digital Certificates

    http://technet.microsoft.com/en-us/library/bb123848(EXCHG.65).aspx

    Understanding Digital Certificates and SSL

    http://technet.microsoft.com/en-us/library/dd351044.aspx

    Digital Certificates Best Practices

    http://technet.microsoft.com/en-us/library/dd351044.aspx#digitalcertificatesbestpractices

    Show trust by adding a digital signature (Access)

    http://office.microsoft.com/en-us/access-help/show-trust-by-adding-a-digital-signature-HA010342008.aspx

    Adding Certificates to the Certificates Store on the Client

    http://msdn.microsoft.com/en-us/library/bb669658.aspx

    Active Directory Certificate Services

    http://technet.microsoft.com/en-us/windowsserver/dd448615.aspx

    As far as the save as for you button not working correctly I would say you could use the  Document.Save Method  (e.g. If ActiveDocument.Saved = False Then ActiveDocument.Save) or SaveAs2. I am not sure what all your button is trying to achieve. Assuming you are trying to call the save as dialog box  something similar to the following would call the Dialog. After that one can manually finish the save.

    Sub saveasdialog()

    MsgBox Dialogs(wdDialogFileSaveAs).Show

    End Sub

    Also check to make sure you don’t have other addins that maybe interupting with your save process (File – Word Options->Addins), if they are disable them and test.

    I hope this is helpful. If you need additional information you may require a more in-depth level of support. Please visit the below link to see the various paid support options that are available to better meet your needs. http://support.microsoft.com/default.aspx?id=fh;en-us;offerprophone

    Thanks!

    Arthur


    Monday, April 30, 2012 4:37 PM

All replies

  • Hi Matt,

    Welcome to the MSDN forum!

    Please check the Group Policy for certificates in corporation environment.

    See:
    Create a certificate trust list for a Group Policy object 
    http://technet.microsoft.com/en-us/library/cc728449(v=WS.10).aspx  

    Add a trusted root certification authority to a Group Policy object
    http://technet.microsoft.com/en-us/library/cc738131(v=WS.10).aspx  

    Please check the following links as well:

    http://social.msdn.microsoft.com/Forums/en-US/wpf/thread/ec4874c5-f8c1-418e-a9d9-fe3efa3075e6

    http://msdn.microsoft.com/en-us/library/ms731899.aspx

    http://office.microsoft.com/en-us/excel-help/digitally-sign-a-macro-project-HA001231781.aspx 

    http://support.microsoft.com/kb/217221

    Thanks.


    Yoyo Jiang[MSFT]
    MSDN Community Support | Feedback to us


    Wednesday, April 25, 2012 8:02 AM
    Moderator
  • Hi Yoyo Jiang,

    From what I can gather from the documentation you've linked me to I need to make the certificate on windows server.  Does this mean that our clients (some of who work as individuals and would not be running windows server at all) will need to install it into their trusted certificates?

    I need this to be as simple as possible on their end...  no matter how complex it makes it on my end.  We do run group policies here obviously, but my authority is dismal, and our server isn't even in our building.  I do however have a copy of Windows Server 2003, but I haven't used it since I was in University.  If you don't mind me asking, can you summarize what I need to do to make this work?  The sales team is starting to get edgy as they have been waiting for this to be complete for a few months now...


    I also have Visual Studio 2010 and office 2010, if that helps.
    • Edited by Matt Bennion Wednesday, April 25, 2012 3:08 PM Addition
    Wednesday, April 25, 2012 3:07 PM
  • Thanks for your response Matt.

    Regarding the difficult issue on the different environments of the clients, I am trying to involve some one familiar with this to help. It will take some time, and your patience will be greatly appreciated. 

    Best Regards,

    yoyo


    Yoyo Jiang[MSFT]
    MSDN Community Support | Feedback to us

    Thursday, April 26, 2012 3:09 AM
    Moderator
  • To answer your question in summary I would check out some of the articles and examples listed below , I think they sure can help get you going. I have also listed some properties and methods that may be useful in your project.

    Document.Signatures Property

    Document.VBASigned Property (Word)

    Signature Object (Office)

    Example:

    'WARNING: ANY USE BY YOU OF THE CODE PROVIDED IN THIS EXAMPLE IS

    'AT YOUR OWN RISK. Microsoft provides this macro code "as is" without warranty of

    'any kind, either express or implied, including but not limited to the implied warranties of

    'merchantability and/or fitness for a particular purpose.

    The following example prompts the user to select a digital signature with which to sign the active document in Microsoft Word. To use this example, open a document in Word and pass this function the name of a certificate issuer and the name of a certificate signer that match the Issued By and Issued To fields of a digital certificate in the Digital Certificates dialog box. This example will test to make sure that the digital signature that the user selects meets certain criteria, such as not having expired, before the new signature is committed to the disk.

    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 does not, 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 canceled."

    End Function

    Below are some links that you probably want to read prior to working on your project as they clarify  a lot of things with signatures and certificates.

    Digital signatures and certificates

    http://office.microsoft.com/en-us/excel-help/digital-signatures-and-certificates-HA010354667.aspx

    Digitally sign your macro project

    http://office.microsoft.com/en-us/excel-help/digitally-sign-your-macro-project-HA010354312.aspx

    Add or remove a digital signature in Office files

    http://office.microsoft.com/en-us/excel-help/add-or-remove-a-digital-signature-in-office-files-HA010354308.aspx

    Plan digital signature settings for Office 2010

    http://technet.microsoft.com/en-us/library/cc545900.aspx

    Understanding Digital Certificates

    http://technet.microsoft.com/en-us/library/bb123848(EXCHG.65).aspx

    Understanding Digital Certificates and SSL

    http://technet.microsoft.com/en-us/library/dd351044.aspx

    Digital Certificates Best Practices

    http://technet.microsoft.com/en-us/library/dd351044.aspx#digitalcertificatesbestpractices

    Show trust by adding a digital signature (Access)

    http://office.microsoft.com/en-us/access-help/show-trust-by-adding-a-digital-signature-HA010342008.aspx

    Adding Certificates to the Certificates Store on the Client

    http://msdn.microsoft.com/en-us/library/bb669658.aspx

    Active Directory Certificate Services

    http://technet.microsoft.com/en-us/windowsserver/dd448615.aspx

    As far as the save as for you button not working correctly I would say you could use the  Document.Save Method  (e.g. If ActiveDocument.Saved = False Then ActiveDocument.Save) or SaveAs2. I am not sure what all your button is trying to achieve. Assuming you are trying to call the save as dialog box  something similar to the following would call the Dialog. After that one can manually finish the save.

    Sub saveasdialog()

    MsgBox Dialogs(wdDialogFileSaveAs).Show

    End Sub

    Also check to make sure you don’t have other addins that maybe interupting with your save process (File – Word Options->Addins), if they are disable them and test.

    I hope this is helpful. If you need additional information you may require a more in-depth level of support. Please visit the below link to see the various paid support options that are available to better meet your needs. http://support.microsoft.com/default.aspx?id=fh;en-us;offerprophone

    Thanks!

    Arthur


    Monday, April 30, 2012 4:37 PM