Sub werte_aus_acrobat_auslesen() ' Testsub für Zugriff auf Acrobat-Felder
Dim rechnungsname(200) As String
Dim Fld As AFORMAUTLib.field
Dim Flds As AFORMAUTLib.Fields
'Set acrobatx = CreateObject("AcroExch.App")
Set acroexchapp = CreateObject("Acroexch.app")
acroexchapp.CloseAllDocs
Set acroexchavdoc = CreateObject("Acroexch.avdoc")
Summe = 0
Set myOlApp = CreateObject("Outlook.Application")
Set myitem = myOlApp.ActiveInspector.CurrentItem
aufgabe_text = myitem.body
ergebistext = "Rechnung " + Chr(9) + "RG1" + Chr(9) + "RG2" + Chr(9) + "RG3" + Chr(9) + "Verwendet" + Chr(13)
Start = 1
zähler = 1
position_rechnung_beginn = InStr(Start, aufgabe_text, "<", 1)
While position_rechnung_beginn <> 0
position_rechnung_ende = InStr(position_rechnung_beginn, aufgabe_text, ">", 1)
rechnungsname(zähler) = Mid(aufgabe_text, position_rechnung_beginn, position_rechnung_ende - position_rechnung_beginn + 1)
zähler = zähler + 1
Start = position_rechnung_ende
position_rechnung_beginn = InStr(Start, aufgabe_text, "<", 1)
Wend
anzahl_rechnungen = zähler - 1
For i = 1 To anzahl_rechnungen
dateiname = Mid(rechnungsname(i), 2, Len(rechnungsname(i)) - 2)
'If i = 1 Then
' dateiname = "c:\dummy\dummy.pdf"
'ElseIf i = 2 Then
' dateiname = "c:\dummy\dummy1.pdf"
'ElseIf i = 3 Then
' dateiname = "c:\dummy\dummy2.pdf"
'Else
' End
'End If
bOK = acroexchavdoc.Open(dateiname, True)
If (bOK) Then
Set aformaut = CreateObject("AFormAut.App")
Set Flds = aformaut.Fields
End If
ergebistext = ergebistext + dateiname + Chr(9)
For Each Fld In Flds
If Fld.Name = "Betrag_Ueberweisung_1_" Then
ergebistext = ergebistext + Fld.Value + Chr(9)
If Val(Fld.Value) <> 0 Then betrag = Val(Fld.Value)
End If
Next
For Each Fld In Flds
If Fld.Name = "Betrag_Ueberweisung_2_" Then
ergebistext = ergebistext + Fld.Value + Chr(9)
If Val(Fld.Value) <> 0 Then betrag = Val(Fld.Value)
End If
Next
For Each Fld In Flds
If Fld.Name = "Betrag_Ueberweisung_3_" Then
ergebistext = ergebistext + Fld.Value + Chr(9)
If Val(Fld.Value) <> 0 Then betrag = Val(Fld.Value)
End If
Next
Summe = Summe + betrag
ergebistext = ergebistext + Format(betrag, "#####.##") + Chr(13)
acroexchapp.CloseAllDocs
'bOK.CloseAllDocs
Next i
ergebistext = ergebistext + Chr(13) + "Gesamtbetrag: " + Format(Summe, "#####.##")
myitem.body = myitem.body + Chr(13) + Chr(13) + "-----" + ergebistext
MsgBox (ergebistext)
'text = "C:\Programme\Adobe\Acrobat 5.0\Acrobat\acrobat.exe"
'text = text + " " + rechnung
'AnwID = Shell(text, 6)
'Set aktuelle_datei = acrobatx.getactivedoc.getpddoc
'Set outlook_fenster = CreateObject("Outlook.Application").ActiveExplorer
'outlook_fenster.Activate
'MsgBox (aktuelle_datei.getfilename)
'MsgBox (acrobatx.getactivedoc.getpddoc.AcquirePage(1).GetNumAnnots)
'formfieldcount)
End Sub
hoffe du blikst es.....
ps: ist aber als makro geschrieben
gruss türk