ich muss in diversen Word Dokumenten nach bestimmten Begriffen suchen, das klappt soweit gant gut, jetzt muss ich aber auch Tabellen in Word durchsuchen und da happerts noch ein wenig. Ich möchte nicht alle Tabellen durchsuchen, sondern nur in einem bestimmten Kapitel. bisher habe ich folgendes:
Function OeffneWordDatei(ByVal strPath As String, ByRef zeile As Long)
Dim strText As String
Dim objWA As Word.Application
Dim objwd As Word.Document
Dim strfile As String
Dim ilen, ipos As Integer
Dim i As Integer
Dim wdtabelle As Word.Table
Dim wdZeile As Word.Row
Dim wdZelle As Word.Cell
strfile = Dir(strPath)
If Len(strfile) > 0 Then
Set objWA = CreateObject("Word.Application")
'objWA.Visible = False
Set objwd = objWA.Documents.Open(strPath)
objwd.AcceptAllRevisions
strText = objwd.Range.Text
ilen = Len(strPath)
ipos = InStrRev(strPath, "\", -1, vbTextCompare)
'strText durchsuchen
Call DurchsucheText(strText, Right(strPath, ilen - ipos), zeile)
'bis hierhin ohne Tabellen
Debug.Print objwd.Tables.Count
For i = 1 To objwd.Tables.Count
Set wdtabelle = objwd.Tables.Item(i)
For Each wdZeile In wdtabelle.Rows
For Each wdZelle In wdZeile.Cells
Debug.Print wdZelle.Range.Text
Next
Next
Next i
Die Tabellen haben alle eine Beschriftung der Form Table "KapitelNr - lfdNr Text"Mit Title komme ich leider nciht darauf, der ist leer.
Hat jemand eine Idee wi ich das umsetzen kann?
Danke
yummi