Cannot write to multiple rows in a table

I can’t write to a second(or more) rows in a table with this scriptEither everything staggers between column and row or everything dumps is the last column.

how can I write to mulitple rows???

I have this string:

“99999%Commercial Power Systems%Schmo,Joe%Test Title%Management Information Systems%CN=Bob Test/O=Domain%01/01/2010%;99998%Commercial Power Systems%Test,Joe%Test Title%02%CN=Bill Jones/O=Domain%02/01/2010%;”

which I’m passing to this sub… (newemployees)

Public Sub GenerateNotice ( newEmployees As String, s As NotesSession, thisdb As NotesDatabase )

Dim maildoc As NotesDocument

Dim rtitem As NotesRichTextItem

Dim rtStyle As NotesRichTextStyle



Dim rtTableStyle(1 To 7) As NotesRichTextParagraphStyle

Dim j, iRow, iColumn, k As integer

Dim finalOrphans As string

						

Set thisDb = s.CurrentDatabase

Set maildoc = thisdb.CreateDocument

Set rtitem = New NotesRichTextItem ( maildoc, "Body")

’ Set our font style

Set rtStyle = s.Createrichtextstyle()

rtStyle.NotesFont = FONT_ROMAN

rtStyle.Fontsize = 9

’ set our table column sizes

For k = 1 To 7 Step 1

	Set rtTableStyle(k) = s.Createrichtextparagraphstyle()

	rtTableStyle(k).Leftmargin = 0

	rtTableStyle(k).Firstlineleftmargin = 0

	rtTableStyle(k).Alignment = ALIGN_CENTER

	'rtTableStyle(k).Alignment = ALIGN_NOWRAP

	rtTableStyle(k).Spacingbelow = SPACING_ONE_POINT_25

	If k = 1 Then

		rtTableStyle(k).RightMargin = RULER_ONE_INCH * .35

	ElseIf k = 2 Then

		rtTableStyle(k).RightMargin = RULER_ONE_INCH * 1.75

	ElseIf k = 3 Then

		rtTableStyle(k).RightMargin = RULER_ONE_INCH * 1.25

	ElseIf k = 4 Then

		rtTableStyle(k).RightMargin = RULER_ONE_INCH * 1.5

	ElseIf k = 5 Then

		rtTableStyle(k).RightMargin = RULER_ONE_INCH * 1.8

	ElseIf k = 6 Then

		rtTableStyle(k).RightMargin = RULER_ONE_INCH * 1.25

	ElseIf k = 7 Then

		rtTableStyle(k).RightMargin = RULER_ONE_INCH * .55

	End If		

Next



Print newEmployees

NewUsers = Split ( newEmployees, ";")	

newList = ArrayUnique ( FullTrim(NewUsers), 4)

stop

j = UBound(newList)



maildoc.Form = "EmailNotice"

maildoc.From = "MIS Tools"

maildoc.sendto = "User/Domain"

maildoc.Subject = "New Employee notification"

maildoc.SaveOptions = "0"



Call maildoc.ReplaceItemValue ("dTitle", " New Employees" )



Call rtitem.AddNewline(1)	

Call rtitem.AppendText ("Here is the current list of New Employees ")

Call rtitem.AddNewline(2)

Call rtitem.Appendstyle(Rtstyle)

Call rtItem.Appendtable( j , 7,, RULER_ONE_INCH * .50, rtTableStyle )



stop	

	Dim rtNav As NotesRichTextNavigator

	Set rtNav = rtItem.Createnavigator()

	Call rtNav.Findfirstelement( RTELEM_TYPE_TABLECELL )

	

	For iRow = 1 To j Step 1

		For iColumn = 1 To 7 Step 1

	

				Call rtNav.Findnextelement(RTELEM_TYPE_TABLECELL)

				Call rtItem.BeginInsert (rtNav)

				fieldValue = StrToken( newlist(iRow - 1), "%", iColumn)

				Call rtItem.Appendtext( fieldValue )

				Call rtItem.Endinsert()

				Call rtNav.Findnextelement(RTELEM_TYPE_TABLECELL)

						

				Next

		

	Next

Call maildoc.send ( True )

Can anyone with table experience help me out?

Subject: I think you would have better luck…

…if you called Findnextelement(RTELEM_TYPE_TABLECELL) only once per loop iteration instead of twice.

Subject: That was it…

Can’t believe I overlooked it…

Thank you!