Sub
PDF_Formular()
Dim
Datei
As
String
, Pfad
As
String
, Name
As
String
Dim
i
As
Integer
For
i = 2
To
Cells(Rows.Count, 5).
End
(xlUp).Row
Set
AcroApp = CreateObject(
"AcroExch.App"
)
Set
AvDoc = CreateObject(
"AcroExch.AVDoc"
)
Datei =
"C:\Users\Documents\Vorlage.pdf"
Pfad = "C:\Users\Ausgefüllte Formulare\"
Name =
"PDF-Datei_ausgefüllt_"
& i &
".pdf"
If
AvDoc.Open(Datei, Name)
Then
AcroApp.Show
Set
PDDoc = AvDoc.GetPDDoc()
Set
jso = PDDoc.GetJSObject
jso.getField(
"Name Debtor"
).Value = ActiveSheet.Cells(5, 3).Value
jso.getField(
"Street and Number"
).Value = ActiveSheet.Cells(6, 3).Value
jso.getField(
"City"
).Value = ActiveSheet.Cells(7, 3).Value
jso.getField(
"Land"
).Value = ActiveSheet.Cells(8, 3).Value
jso.getField(
"Name Creditor"
).Value = ActiveSheet.Cells(i, 5).Value
jso.getField(
"Adress Creditor"
).Value = ActiveSheet.Cells(i, 6).Value
jso.getField(
"Type of activityreason for payment 1"
).Value = ActiveSheet.Cells(10, 3).Value
jso.getField(
"Type of activityreason for payment 2"
).Value = ActiveSheet.Cells(11, 3).Value
jso.getField(
"date of payment"
).Value = ActiveSheet.Cells(i, 7).Value
jso.getField(
"period of activity"
).Value = ActiveSheet.Cells(i, 8).Value
jso.getField(
"Euro"
).Value =
CStr
(Cells(i, 13).Value)
jso.getField(
"Cent"
).Value =
CStr
(Cells(i, 14).Text)
jso.getField(
"Euro_2"
).Value =
CStr
(Cells(i, 15).Value)
jso.getField(
"Cent_2"
).Value =
CStr
(Cells(i, 16).Text)
jso.getField(
"Euro_3"
).Value =
CStr
(Cells(i, 17).Value)
jso.getField(
"Cent_3"
).Value =
CStr
(Cells(i, 18).Text)
jso.getField(
"tax office"
).Value = ActiveSheet.Cells(13, 3).Value
jso.getField(
"tax number"
).Value = ActiveSheet.Cells(14, 3).Value
PDDoc.Save PDSaveFull, Pfad & Name
PDDoc.Close
AvDoc.Close (
True
)
AcroApp.Hide
AcroApp.
Exit
Set
AcroApp =
Nothing
Set
AvDoc =
Nothing
Set
PDDoc =
Nothing
Set
jso =
Nothing
Else
MsgBox
"Dokument nicht gefunden!"
Set
AcroApp =
Nothing
Set
AvDoc =
Nothing
Set
PDDoc =
Nothing
Set
jso =
Nothing
End
If
Next
i
End
Sub