I'm trying to loop through selected tables, rows, columns, and cells.
However, I cant get the Table object to set properly into the variable in the for loop.
I inspected the element TypeName(objSel.Tables.Item(1)
to validate that the type IS of type Table. But I keep getting a "Type Missmatch" error.
1 Answer
It loods like the issue was because it was trying to store a Word.Table into an Outlook.Table.
Before (Not Working):
Dim aTbl As Table
Dim i As Integer
For i = 1 To objSel.Tables.Count()
Debug.Print (TypeName(objSel.Tables.Item(i)))
Set aTbl = objSel.Tables.Item(i)
Debug.Print (TypeName(aTbl))
Next
After (working):
Dim aTbl As Word.Table
Dim i As Integer
For i = 1 To objSel.Tables.Count()
Debug.Print (TypeName(objSel.Tables.Item(i)))
Set aTbl = objSel.Tables.Item(i)
Debug.Print (TypeName(aTbl))
Next
for each
verb, if it does not implement an iterator for instance.*.Tables.
the options are:Add, Application, Count, Creator, Item, Nesting Level, Parent
inspector
- make sure it's all syntactically correct from application to application.