我有以下代码来阅读outlook电子邮件中的表格。但我在第ActiveInspector.WordEditor
行收到错误。
Set doc = ActiveInspector.WordEditor
Set tbl = doc.Tables(1)
lngRows = tbl.Rows.Count
lngColumns = tbl.Columns.Count
我也在参考文献中标记了Microsoft Word 12.0 Object Library
。有人可以帮忙吗?
我试图解决我在这里提到的问题:
答案 0 :(得分:1)
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