VBA unable to modify PDF in Adobe DC Pro

CrispyAsian

Board Regular
Joined
Sep 22, 2017
Messages
64
Hello all,

So I have a problem with some code I've been using for a while. I have a macro that creates a PDF and then opens that PDF to input some signature and text boxes to be filled out after it's creation. My office just recently moved from the old Adobe Acrobat to Adobe DC Pro and now when I use my macro, it still creates the PDF but no longer adds the signature or textboxes to the form although it acts like it is. Is there a new reference I need to add in to have it work with Adobe DC Pro or is there some different formatting I need to do to make it communicate properly? Here's what I'm working with:

VBA Code:
Private Sub MakePDF()

Dim jso As Object
Dim Path As String
Dim mySigRect As String
Dim file_name As Variant
Dim i As Integer
Dim x As Integer

file_name = Application.GetSaveAsFilename(FileFilter:="PDF Files (*.pdf), *.pdf")

If file_name <> False Then
ThisWorkbook.Sheets(Array("4324 Front", "4324 Back")).Select
ActiveSheet.ExportAsFixedFormat Type:=xlTypePDF, Filename:=file_name, _
Quality:=xlQualityStandard, IncludeDocProperties:=True, _
IgnorePrintAreas:=False

UserForm1.ProgressBar1.Value = 1

Set AcroApp = CreateObject("AcroExch.App")
Set gpdDoc = CreateObject("AcroExch.PDDoc")
Path = file_name

UserForm1.ProgressBar1.Value = 2

If gpdDoc.Open(Path) Then
Set jso = gpdDoc.GetJSObject
End If

If Not jso Is Nothing Then
If gpdDoc.Open(dest) Then
Set jso = gpdDoc.GetJSObject
End If

Set Box1 = jso.AddField("Initials1", "text", 0, Array(72, 107.32, 41, 126.2))
Box1.TextSize = 10

Set Box2 = jso.AddField("Initials2", "text", 0, Array(175, 107.32, 143, 126.2))
Box2.TextSize = 10

Set Box3 = jso.AddField("Initials3", "text", 0, Array(282, 107.32, 252, 126.2))
Box3.TextSize = 10

Set Box4 = jso.AddField("Initials4", "text", 0, Array(385, 107.32, 354, 126.2))
Box4.TextSize = 10

Set Box5 = jso.AddField("Initials5", "text", 0, Array(489, 107.32, 456, 126.2))
Box5.TextSize = 10

UserForm1.ProgressBar1.Value = 3

Set Box6 = jso.AddField("Initials6", "text", 0, Array(72, 50, 41, 71))
Box6.TextSize = 10

Set Box7 = jso.AddField("Initials7", "text", 0, Array(175, 50, 143, 71))
Box7.TextSize = 10

Set Box8 = jso.AddField("Initials8", "text", 0, Array(282, 50, 252, 71))
Box8.TextSize = 10

UserForm1.ProgressBar1.Value = 4

Set Box9 = jso.AddField("Initials9", "text", 0, Array(385, 50, 354, 71))
Box9.TextSize = 10

Set Box10 = jso.AddField("Initials10", "text", 0, Array(489, 50, 456, 71))
Box10.TextSize = 10

UserForm1.ProgressBar1.Value = 5

Set BoxA = jso.AddField("Date1", "text", 0, Array(140, 107.32, 79, 126.2))
BoxA.TextSize = 10

Set BoxB = jso.AddField("Date2", "text", 0, Array(248, 107.32, 180, 126.2))
BoxB.TextSize = 10

Set BoxC = jso.AddField("Date3", "text", 0, Array(351, 107.32, 287, 126.2))
BoxC.TextSize = 10

UserForm1.ProgressBar1.Value = 6

Set BoxD = jso.AddField("Date4", "text", 0, Array(453, 107.32, 392, 126.2))
BoxD.TextSize = 10

Set BoxE = jso.AddField("Date5", "text", 0, Array(570, 107.32, 497, 126.2))
BoxE.TextSize = 10

UserForm1.ProgressBar1.Value = 7

Set BoxF = jso.AddField("Date6", "text", 0, Array(140, 50, 79, 71))
BoxF.TextSize = 10

Set BoxG = jso.AddField("Date7", "text", 0, Array(248, 50, 180, 71))
BoxG.TextSize = 10

Set BoxH = jso.AddField("Date8", "text", 0, Array(351, 50, 287, 71))
BoxH.TextSize = 10

Set BoxI = jso.AddField("Date9", "text", 0, Array(453, 50, 392, 71))
BoxI.TextSize = 10

Set BoxJ = jso.AddField("Date10", "text", 0, Array(570, 50, 497, 71))
BoxJ.TextSize = 10

UserForm1.ProgressBar1.Value = 8

Set oAdd1 = jso.AddField("Signature1", "signature", 0, Array(43, 531, 247, 495))
Set oAdd2 = jso.AddField("Signature2", "signature", 0, Array(252, 531, 420, 495))
Set oAdd3 = jso.AddField("Signature3", "signature", 0, Array(426, 531, 574, 495))


UserForm1.ProgressBar1.Value = 9

i = 1
x = 0

For Each c In ThisWorkbook.Sheets("4324 Front").Range("E27:E34")
If c.Value = "" Then

Set Box = jso.AddField("Add/Delete" & i, "text", 0, Array(72, 298 + x, 41, 313 + x))
Box.TextSize = 10
Set Box = Nothing

Set Box = jso.AddField("Program Code" & i, "text", 0, Array(175, 298 + x, 76, 313 + x))
Box.TextSize = 10
Set Box = Nothing

Set Box = jso.AddField("Profile Name" & i, "text", 0, Array(282, 298 + x, 177, 313 + x))
Box.TextSize = 10
Set Box = Nothing

Set Box = jso.AddField("Eff Date" & i, "text", 0, Array(351, 298 + x, 285, 313 + x))
Box.TextSize = 10
Set Box = Nothing

Set Box = jso.AddField("Tailor Pro" & i, "text", 0, Array(420, 298 + x, 355, 313 + x))
Box.TextSize = 10
Set Box = Nothing

Set Box = jso.AddField("Months" & i, "text", 0, Array(491, 298 + x, 424, 313 + x))
Box.TextSize = 10
Set Box = Nothing

Set Box = jso.AddField("Remarks" & i, "text", 0, Array(577, 298 + x, 495, 313 + x))
Box.TextSize = 10
Set Box = Nothing

i = i + 1
x = x - 18
Else
x = x - 18
End If
Next c

UserForm1.ProgressBar1.Value = 10

End If

Set AcroApp = Nothing
Set gpdDoc = Nothing
Path = ""

End If

End Sub

I know it's not the prettiest code but it used to work in the past. Can anybody with experience working with PDFs in VBA help me out? I would appreciate it very much. Thank you, have a good day.

-CrispyAsian
 

Excel Facts

Easy bullets in Excel
If you have a numeric keypad, press Alt+7 on numeric keypad to type a bullet in Excel.

Forum statistics

Threads
1,224,823
Messages
6,181,181
Members
453,022
Latest member
Mohamed Magdi Tawfiq Emam

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