Finding tables within an MS Word document

Hey guys,

I am basically going through several ms word documents and extracting the entire content out as html. The problem is I have no clue as to how I can find the table location within each document, as there can be several tables in any given one.

Is there any way to locate these tables in VB

any help would be much appreicated

regards


joe


Answer this question

Finding tables within an MS Word document

  • NetPochi

    Make sure to set the variable instances but this should work for ya:

    Dim MSWord As New Word.Application

    Dim WordTable As Word.Table

    Dim Doc As Word.Document

    Dim r As Word.Row

    Dim c As Word.Cell

    For Each WordTable In Doc.Tables

    For Each r In WordTable.Rows

    For Each c In r.Cells

    Next

    Next

    Next

    That code will traverse every cell in every row of every table in a word document



  • Finding tables within an MS Word document