Readdy Write

Vba Makro: Finde Tabelle Zeile Reihe

20.07.2018 (👁2726)

zu vba Word Tutorial 

Dieser vba Makro Code zeigt, wie man die Tabelle, Zeile und Spalte in einem Word Dokument findet, welche einen gesuchten Text enthält.

Private intRow_Match As Integer

Private intColumn_Match As Integer

 

Sub Makro1()

    '

    ' unser VBA Makro 1

    '

    '

    Dim intTable As Integer

    intTable = fx_get_Table()

 

 

End Sub

 

 

 

 

Private Function fx_get_Table() As Integer

    '--------< fx_get_Table() >--------

    '< init >

    Dim iTable As Integer

    '</ init >

 

    '----< @Loop: Tables >----

    For iTable = 1 To Tables.Count

        

        Set tbl = Tables(iTable)

        

        '--< @Loop: Rows >--

        Dim iRow As Integer

        For iRow = 1 To tbl.Rows.Count

            '--< @Loop: Columns >--

            Dim iColumn As Integer

            For iColumn = 0 To tbl.Columns.Count

                '< Cell >

                Dim varCell As Variant

                Set varCell = tbl.Cell(iRow, iColumn)

                If varCell.Range.Text Like "Bild*" Then

                    '< match >

                    intRow_Match = iRow

                    intColumn_Match = iColumn

 

                    '< out >

                    fx_get_Table = iTable

                    Exit For

                    '</ out >

 

                    '</ match >

                End If

                '</ Cell >

            Next

            '--</ @Loop: Columns >--

        Next

        '--</ @Loop: Rows >--

    Next

    '----</ @Loop: Tables >----

 

    '< out >

    'fx_get_Table =

    '</ out >

    '--------</ fx_get_Table() >--------

End Function

In der entsprechenden Code Seite


0,00 €