Sub
PDF_Formular()
Dim
Datei
As
String
, Pfad
As
String
, Name
As
String
Set
AcroApp = CreateObject(
"AcroExch.App"
)
Set
AvDoc = CreateObject(
"AcroExch.AVDoc"
)
Datei = "C:\Users\bdornhecker\Documents\Formular\"
Pfad = "C:\Users\bdornhecker\Documents\Ausgefüllte Formulare\"
Name =
"PDF-Datei_ausgefüllt.pdf"
If
AvDoc.Open(Datei, Name)
Then
AcroApp.Show
Set
PDDoc = AvDoc.GetPDDoc()
Set
jso = PDDoc.GetJSObject
jso.getField(
"Name Debtor"
).Value = ActiveSheet.Range(
"A2"
).Value
jso.getField(
"Street and Number"
).Value = ActiveSheet.Range(
"B2"
).Value
jso.getField(
"City"
).Value = ActiveSheet.Range(
"C2"
).Value
jso.getField(
"Land"
).Value = ActiveSheet.Range(
"D2"
).Value
jso.getField(
"Name Creditor"
).Value = ActiveSheet.Range(
"E2"
).Value
jso.getField(
"Adress Creditor"
).Value = ActiveSheet.Range(
"F2"
).Value
jso.getField(
"Type of activityreason for payment 1"
).Value = ActiveSheet.Range(
"G2"
).Value
jso.getField(
"Type of activityreason for payment 2"
).Value = ActiveSheet.Range(
"H2"
).Value
jso.getField(
"date of payment"
).Value = ActiveSheet.Range(
"I2"
).Value
jso.getField(
"period of activity"
).Value = ActiveSheet.Range(
"J2"
).Value
jso.getField(
"Euro"
).Value = ActiveSheet.Range(
"K2"
).Value
jso.getField(
"Cent"
).Value = ActiveSheet.Range(
"L2"
).Value
jso.getField(
"Euro_2"
).Value = ActiveSheet.Range(
"M2"
).Value
jso.getField(
"Cent_2"
).Value = ActiveSheet.Range(
"N2"
).Value
jso.getField(
"Euro_3"
).Value = ActiveSheet.Range(
"O2"
).Value
jso.getField(
"Cent_3"
).Value = ActiveSheet.Range(
"P2"
).Value
jso.getField(
"tax office"
).Value = ActiveSheet.Range(
"Q2"
).Value
jso.getField(
"tax number"
).Value = ActiveSheet.Range(
"R2"
).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
End
Sub