Redim TempArray(0)
Lose that line. The function will return a populated array. Redimensioning it to a single dimension may confuse VBA.
Keep in mind that VBA arrays are often, but not always, 1-based (not zero-based). When I write code I put the Option Base 0 statement at the top of each module to avoid any doubt. When extracting details of an array, use the LBound() and UBound() functions to find where an array starts and ends.
These troublesome VBA ListBoxes have been around for a couple of decades. I'm sure that you're not the first to have problems with them. Search other VBA sites for hints & tips. No doubt the Excel VBA developers have some advice.