Try this sub, it's not very well programmed, but it should do the trick.
You need to add the code to the ThisDocument module in the VBA editor (press Alt+F11 to open it).
Actually, the TheText() event won't call the formatting function AFTER you're done with the text editing: It will be called time and again while modify the text (whenever you press a key, format or resize your text box), which would be quite inefficient.
I would use another event, like EvntDoubleClick() instead, or a user defined menu optionj, to call the changeColor sub.
Sub changeColor(oShape As Visio.Shape)
On Error GoTo Err_changeColor
Dim iLength As Integer
Dim iBeginOffset As Integer, iEndOffset As Integer
Dim oShpChar As Visio.Characters
Set oShpChar = oShape.Characters
iLength = oShpChar.CharCount
' Main loop: We go through all the text selecting the adecuate portions to change
Do
' Find the position of next # character
iBeginOffset = InStr(oShpChar.Text, "#")
If iBeginOffset = 0 Then Exit Do ' # Not found -> end the loop
' Find the position of next LF to change color only until the end of the line
iEndOffset = InStr(iBeginOffset, oShpChar.Text, vbLf)
If iEndOffset = 0 Then iEndOffset = iLength - oShpChar.Begin ' If not found, change everything
' Update the portion to change
oShpChar.End = oShpChar.Begin + iEndOffset ' We use the previous beginning position plus the offset
oShpChar.Begin = oShpChar.Begin + iBeginOffset - 1 ' Idem. We want to change #'s color, too, thus the (-1)
' Change color of the selected text (between Begin and End) to green (9)
oShpChar.CharProps(visCharacterColor) = 9
oShpChar.Begin = oShpChar.Begin + 1 ' We don't want to find the same # again, so we undo the previous (-1)
oShpChar.End = iLength ' We want to continue searching until the end
Loop While (iEndOffset <> iLength)
Exit_changeColor:
If Not oShpChar Is Nothing Then Set oShpChar = Nothing
Exit Sub
Err_changeColor:
MsgBox Err.Number & ": " & Err.Description, vbExclamation, "Error"
Resume Exit_changeColor
End Sub