Sub
PDF_Formular()
Dim
Datei
As
String
, Pfad
As
String
Dim
Name
As
String
Dim
i
As
Integer
i = 2
Do
While
Cells(i, 1) =
" "
Set
AcroApp = CreateObject(
"AcroExch.App"
)
Set
AvDoc = CreateObject(
"AcroExch.AVDoc"
)
Datei =
"C:\Users\bdornhecker\Documents\PDF befüllen\Formular.pdf"
Pfad = "C:\Users\bdornhecker\Documents\PDF befüllen\Ausgefüllte Formulare\"
Name =
"PDF-Datei_ausgefüllt"
+ i
If
AvDoc.Open(Datei, Name)
Then
AcroApp.Show
Set
PDDoc = AvDoc.GetPDDoc()
Set
jso = PDDoc.GetJSObject
jso.getField(
"Name Debtor"
).Value = ActiveSheet.Cells(i, 1).Value
jso.getField(
"Street and Number"
).Value = ActiveSheet.Cells(i, 2).Value
jso.getField(
"City"
).Value = ActiveSheet.Cells(i, 3).Value
jso.getField(
"Land"
).Value = ActiveSheet.Cells(i, 4).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(i, 7).Value
jso.getField(
"Type of activityreason for payment 2"
).Value = ActiveSheet.Cells(i, 8).Value
jso.getField(
"date of payment"
).Value = ActiveSheet.Cells(i, 9).Value
jso.getField(
"period of activity"
).Value = ActiveSheet.Cells(i, 10).Value
jso.getField(
"Euro"
).Value = ActiveSheet.Cells(i, 11).Value
jso.getField(
"Cent"
).Value = ActiveSheet.Cells(i, 12).Value
jso.getField(
"Euro_2"
).Value = ActiveSheet.Cells(i, 13).Value
jso.getField(
"Cent_2"
).Value = ActiveSheet.Cells(i, 14).Value
jso.getField(
"Euro_3"
).Value = ActiveSheet.Cells(i, 15).Value
jso.getField(
"Cent_3"
).Value = ActiveSheet.Cells(i, 16).Value
jso.getField(
"tax office"
).Value = ActiveSheet.Cells(i, 17).Value
jso.getField(
"tax number"
).Value = ActiveSheet.Cells(i, 18).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
i = i + 1
Loop
End
Sub