Set
oExcelApp = CreateObject(
"Excel.Application"
)
Set
oExcelWorkbook = oExcelApp.Workbooks.Open(ThisDocument.Path & DatenBezug)
meineBM = Array(
"TM_E_Firma"
,
"TM_E_StrHnr"
,
"TM_E_PLZ"
,
"TM_E_Ort"
,
"TM_E_Tel"
,
"TM_E_Fax"
,
"TM_E_Mail"
,
"TM_E_KD"
)
lZeile = 2
With
oExcelWorkbook.Sheets(DatEmpfaenger)
Do
While
.Cells(lZeile, 2) <>
""
If
ListBox1.Text =
CStr
(.Cells(lZeile, 1).Value)
Then
For
i = 0
To
7
If
ActiveDocument.Bookmarks.Exists(meineBM(i))
Then
Set
TMRange = ActiveDocument.Bookmarks(meineBM(i)).Range
TMRange =
CStr
(.Cells(lZeile, i + 3).Value)
ActiveDocument.Bookmarks.Add meineBM(i), TMRange
Set
TMRange =
Nothing
End
If
Next
i
Exit
Do
End
If
lZeile = lZeile + 1
Loop
End
With