0
votes

I need to read the pure text values from cells of a table located in the page header of a word document using vbscript.

All i could achieve until now is to read some kind of text from the header by this:

wscript.echo WordApp.ActiveDocument.Sections(1).Headers(1).Range.FormattedText.Text

But how can i gain access to the table object and read each cell value?

1

1 Answers

1
votes

Tables in Word documents can be enumerated via the Tables collection.

For Each tbl In WordApp.ActiveDocument.Sections(1).Headers(1).Range.Tables
  For i = 1 To tbl.Rows.Count
    For j = 1 To tbl.Columns.Count
      WScript.Echo tbl.Cell(i, j).Value
    Next
  Next
Next