bradyboyy88
Well-known Member
- Joined
- Feb 25, 2015
- Messages
- 562
I am working on some code in excel vba and trying to open a word document, then add a signature to the bottom, sign it, then export it as as pdf. So far here is what I have:
I am using the following methodology to add the signature but the problem is it requires the user to hit enter to verify the details. Is there a method to do that automatically?
Code:
Sub ExportSignedPDF
'Open Word Doc
Dim WordApp As Word.Application
Dim WordDoc As Word.Document
Set WordApp = CreateObject("Word.Application")
Set WordDoc = WordApp.Documents.Open("c:/user/blahblah.docx")
Dim n As Long
'Delete any comments
Dim oComments As Object
Set oComments = WordDoc.Comments
For n = oComments.Count To 1 Step -1
oComments(n).Delete
Next 'n
'Add signature and sign it with user information -- Need Help
'Remove track changes
WordDoc.Revisions.AcceptAll
'Create PDF -- Need Help
WordApp.Documents.Save
WordApp.Quit
Set oComments = Nothing
Set WordDoc = Nothing
Set WordApp = Nothing
End Sub
I am using the following methodology to add the signature but the problem is it requires the user to hit enter to verify the details. Is there a method to do that automatically?
Code:
Sub Macro1()
Dim mysignature1 As Signature
Set mysignature1 = ActiveDocument.Signatures.AddSignatureLine("{00000000-0000-0000-0000-000000000000}")
mysignature1.Setup.SuggestedSigner = "Name"
mysignature1.Setup.SuggestedSignerLine2 = "Project Manager"
mysignature1.Setup.SuggestedSignerEmail = "email@domain.com"
End Sub
Last edited by a moderator: