Im trying out the code below:
But an error occurs at:
tblXml = wdXml.Tables.Item(1)
Which said that my request collection doesnt exist.
The program manage to display the data in the console but seems to have error before it terminates..
Please advise..
Thank you.
Code:
Dim waXml As New Word.Application
Dim wdXml As New Word.Document
Try
wdXml = waXml.Documents.Open(strDocPath)
Dim tblXml As Word.Table
Dim rowXml As Word.Row
Dim cllXml As Word.Cell
Dim prXml As Word.Paragraph
tblXml = wdXml.Tables.Item(1)
For Each cllXml In tblXml.Range.Cells
For Each prXml In cllXml.Range.Paragraphs
Console.WriteLine(prXml.Range.Text.ToString)
Next
Next
tblXml = wdXml.Tables.Item(2)
For Each cllXml In tblXml.Range.Cells
For Each prXml In cllXml.Range.Paragraphs
Console.WriteLine(prXml.Range.Text.ToString)
Next
Next
Catch ex As Exception
MsgBox("Error: " & ex.ToString)
Finally
wdXml.Close()
waXml.Quit()
End Try
But an error occurs at:
tblXml = wdXml.Tables.Item(1)
Which said that my request collection doesnt exist.
The program manage to display the data in the console but seems to have error before it terminates..
Please advise..
Thank you.