Desktop: analyze a TextArea holding html Xoo created code

The code below works fine with Xojo 2022r2.1, but creates wrong tables while running in Xojo 2024r4.2:

Var Pos_Start    As Integer = 0
Var Pos_End      As Integer
Var Pos_Actual   As Integer = 0
Var Tag_Start    As String = "<a name=" + Chr(34) // <a name="
Var Tag_End      As String = Chr(34) + ">" //  ">"
Var Issue_Length As Integer
Var Entries()    As String

// ********** ********** ********** **********
// 1. Create the href entries

// Start the search after <a href="#master_table"></a><br>
// 

// Where is "master_table" ?
Pos_Actual = TA.Text.IndexOf("master_table") // There is one.

// result=array.IndexOf(TargetValue [,StartingIndex]) -- Xojo 2021r2.1
// Result = -1 if nothing found

// Build the href=# table
Do Until TA.Text.IndexOf(Pos_Actual, Tag_Start) = -1
  // Get the Position of the Issue Name and Number Start Tags
  Pos_Start = TA.Text.IndexOf(Pos_Actual, Tag_Start)
  
  // Stop here if no more Tag_Start String in the text
  If Pos_Start = -1 Then Exit
  
  // Set the actual Character Position
  Pos_Actual = Pos_Start
  
  // Get the Position of the end tag
  Pos_End = TA.Text.IndexOf(Pos_Actual, Tag_End)
  
  // Get the length of the Text to copy
  Issue_Length = Pos_End - Pos_Start
  
  // Select the Text
  TA.SelectionStart = Pos_Start
  TA.SelectionLength = Issue_Length - 1 // To not get the ending quote…
  
  // Get the Text
  Var Issue_NN As String
  Var Entry_NN As String
  
  // Get the Magazine Name and Number
  Issue_NN = TA.SelectedText.Middle(8+1)
  Entry_NN = "<a href=" + Chr(34) +"#" + Issue_NN + Chr(34) + ">" + Issue_NN + "</a><br>"
  
  // Add the Name and issue number
  Entries.Add Entry_NN
  
  // Update the Character current Position
  Pos_Actual = 0 // Change nothing, but who knows ?
  Pos_Actual = Pos_End
  
  // ********** ********** ********** **********
  // [2025-01-2] Block added today for Xojo 2024r4.2
  Pos_Start = 0
  Pos_End   = 0
  Issue_Length = 0
  TA.SelectionStart  = 0
  TA.SelectionLength = 0
  Issue_NN = ""
  Entry_NN = ""
  // ********** ********** ********** **********
  
  // To avoid infinite loop
  If UserCancelled Then Exit
Loop

// ********** ********** ********** **********
// Build the ToC <table that will be inserted
Var Entry_Cnt As Integer = Entries.Count

// Add the Column definitions
Entries.AddAt((Entry_Cnt / 4)*3, "</td>" + EndOfLine + "<td width=250>")
Entries.AddAt((Entry_Cnt / 4)*2, "</td>" + EndOfLine + "<td width=250>")
Entries.AddAt((Entry_Cnt / 4)*1, "</td>" + EndOfLine + "<td width=250>")
Entries.AddAt(0, "<tr bgcolor=lightgreen valign=top>" + EndOfLine + "<td width=250>")

// Add the header and table definitions
// Header definition
Entries.AddAt(0, "<tr bgcolor=yellow><th colspan=4>Sommaire (" + Entry_Cnt.ToString + " numéros)</th></tr>")

// Table definition
Entries.AddAt(0, "<p><table cellpadding=5 cellspacing=0 border=1 align=left width=1000>")

// Close the last Column and the table
Entries.Add "</td>" + EndOfLine + "</tr></table>" + EndOfLine

// Remove any selection and place the cursor at 0
TA.SelectionLength = 0
TA.SelectionStart  = 0

// Returns the result
Return Entries