Reputation: 1461
I have the code below to read the table from outlook email. But I'm getting error at the line ActiveInspector.WordEditor
.
Set doc = ActiveInspector.WordEditor
Set tbl = doc.Tables(1)
lngRows = tbl.Rows.Count
lngColumns = tbl.Columns.Count
I've marked the Microsoft Word 12.0 Object Library
in the references as well. Can someone help?
I'm trying to solve the problem I mentioned here:
Read a table in outlook mail using macro
Upvotes: 3
Views: 831
Reputation: 9179
If you are using ActiveExplorer.Selection.Item(1) change to either starting with an open mailitem or
Sub inspWord()
Dim doc As Word.Document
Dim tbl As Word.Table
Dim lngRows As Long
Dim lngColumns As Long
ActiveExplorer.Selection.Item(1).Display
Set doc = ActiveInspector.WordEditor
Set tbl = doc.Tables(1)
lngRows = tbl.Rows.count
lngColumns = tbl.Columns.count
End Sub
Upvotes: 1