Hi,
I’m trying to access a second richtexttable object in a rich text field. I have created the object successfully (2 tables show in document)but I can’t get the table using findnextelement (gives error message “Position is not valid”). If I use FindLastElement I get strange results.
My code adds new lines to the second table, but appends text into the first table. Its as if the second table is only partially available. I’d be grateful for any ideas, other than creating a second rich text field and putting the table in that!! Code extract follows
Call rtnavBody.FindLastElemen(RTELEM_TYPE_TABLE)
Set rtt = rtnavBody.GetElement’ attempts to get second table
next few lines access first table so rtt is not pointing at second table (I’m reusing rtt object)
rc% = rtt.RowCount
cc% =rtt.ColumnCount
'Calculate total number of table cells
rcc% =rc%*cc%
'Calculate cell number of the first cell in the new (last) row
cl% =rcc%-2
'Move to the first cell in the last row
Call rtnavBody.FindNthElement(RTELEM_TYPE_TABLECELL,cl%)
BUT, next line accesses second table using same rtt object !!!
While Not (contract Is Nothing)
Call rtt.AddRow() ' add row for each document found