I have this problem too! Did you find an solution?
I am using this code which is very similar to yours:
Code:
Sub ExampleWriteExpression()
'insertion point should be in equation. Metric expression written (wdOMathFunctionScrSub) at end. Then
Dim LetterCode As Integer, Letter0 As Integer
Dim Equation As OMath
Dim MathTerm As OMathFunction
Dim MyRange As Range
If Selection.OMaths.Count <> 1 Then ExpanderFatalError ("Cursor must be in an equation.")
Set Equation = Selection.OMaths(1)
Set MyRange = Equation.Range
MyRange.Collapse (wdCollapseEnd)
Set MathTerm = Equation.Functions.Add(MyRange, wdOMathFunctionScrSub)
MathTerm.ScrSub.E.Range = "g"
MathTerm.ScrSub.Sub.Range = ChrW(&H3BC) & ChrW(&H3BD)
Set MathTerm = Equation.Functions.Add(MyRange, wdOMathFunctionNormalText) 'does not add anything to Equation.Functions
Set MathTerm = Equation.Functions.Add(MyRange, wdOMathFunctionText) 'error 6219
'The text function cannot be applied to a selection
'We do want to add a wdOMathFunctionText, because that is the kind of function we had
'when the original equation just contains X or X= as can be seen in the debugger
End Sub