Inserts Digital Signature Block into PDF Output form word using VBA

786syednadeem

New Member
Joined
Aug 12, 2021
Messages
3
Office Version
  1. 365
Platform
  1. Windows
I found something for excel but nothing for word. can someone please help if there is such a program?

Thanks in advance.
 

Excel Facts

Who is Mr Spreadsheet?
Author John Walkenbach was Mr Spreadsheet until his retirement in June 2019.
Welcome to the board.
What do you have for excel?
This may help. And maybe provide some more details.
 
Upvote 0
Thanks for your response bobsan42. Please see below...
I have a repetitive work of editing, finalizing word reports (daily), converting them to pdf, adding a signature field through adobe and sending them to supervisor for signature.
I want to know if there is a VBA program, which could be used to automate in order to save the word as .pdf and add the signature field automatically.

Any help appreciated. Thanks in advance.

The below is what I found from some thread for excel.


VBA Code:
Public Sub Save_Sheet_As_PDF_Add_Signature_Field()

Worksheets("Calc Sheet").Unprotect Password:=""

Dim PDDoc As Object
Dim AVDoc As Object
Dim JSO As Object
Dim formField As Object
Dim formField2 As Object
Dim inputPDFfile As String, outputPDFfile As String
Dim coords() As Variant
Dim coords2() As Variant
Dim filnam As String

filnam = Worksheets("Formulas").Range("V5") & " - " & Worksheets("Formulas").Range("V4") & " - " & Format(Date, "dd MMM yy")
' coordinates for QC signature
Const BOTTOM_LEFT_X = 315
Const BOTTOM_LEFT_Y = 50
Const WIDTH = 320
Const HEIGHT = 30


'Coordinates specifying position and size of the signature field's bounding rectangle, with origin (0,0) at bottom left of page,
'in the following order: top-left x, top-left y, bottom-right x and bottom-right y.

coords = Array(BOTTOM_LEFT_X, BOTTOM_LEFT_Y + HEIGHT, BOTTOM_LEFT_X + WIDTH, BOTTOM_LEFT_Y)


With ActiveSheet
inputPDFfile = ThisWorkbook.Path & "\Calc Sheets\delete\" & filnam & ".pdf"
outputPDFfile = ThisWorkbook.Path & "\Calc Sheets\" & filnam & " - " & " WSF.pdf"
.ExportAsFixedFormat Type:=xlTypePDF, Filename:=inputPDFfile, _
Quality:=xlQualityStandard, IncludeDocProperties:=True, IgnorePrintAreas:=False, OpenAfterPublish:=False
End With

Set PDDoc = CreateObject("AcroExch.PDDoc")
Set AVDoc = CreateObject("AcroExch.AVDoc")

If PDDoc.Open(inputPDFfile) Then
Set JSO = PDDoc.GetJSObject
Set formField = JSO.AddField("SignatureField", "signature", 0, coords) '0 = 1st page
formField.StrokeColor = JSO.Color.Black 'StrokeColor sets the border and text colours of the field

If PDDoc.Save(1, outputPDFfile) Then
PDDoc.Close
AVDoc.Open outputPDFfile, vbNullString
AVDoc.BringToFront
AVDoc.Close True
Else
MsgBox "Unable to save: " & outputPDFfile
End If
End If

Kill inputPDFfile

Worksheets("Calc Sheet").Protect Password:=""
End Sub
 
Upvote 0

Forum statistics

Threads
1,223,243
Messages
6,170,967
Members
452,371
Latest member
Frana

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top