none
Breakthrough limit of EVAL() RRS feed

  • Question

  • I find that Ms Word's Eval() just support calling internal functions, but not custom functions. How can I breakthrough this limitation?
    N.B. CallByName & Application.Run are not considered, since they just allow calling one function in a time, but not a mixed complex calculations.

    Wednesday, March 2, 2016 4:13 AM

Answers

  • >>>I find that Ms Word's Eval() just support calling internal functions, but not custom functions. How can I breakthrough this limitation?

    According to your description, what's Ms Word Eval() function, as far as I know that Access support Eval function, and Eval can evaluate objects within the Access application. It doesn't recognize objects within the Word application.

    For more information, click here to refer about Eval Function

    In addition could you provide more information about your issue, for example sample code, screenshot etc., that will help us reproduce and resolve it.

    Thanks for your understanding.

    • Marked as answer by David_JunFeng Sunday, March 13, 2016 1:03 PM
    Thursday, March 3, 2016 1:43 AM

All replies

  • >>>I find that Ms Word's Eval() just support calling internal functions, but not custom functions. How can I breakthrough this limitation?

    According to your description, what's Ms Word Eval() function, as far as I know that Access support Eval function, and Eval can evaluate objects within the Access application. It doesn't recognize objects within the Word application.

    For more information, click here to refer about Eval Function

    In addition could you provide more information about your issue, for example sample code, screenshot etc., that will help us reproduce and resolve it.

    Thanks for your understanding.

    • Marked as answer by David_JunFeng Sunday, March 13, 2016 1:03 PM
    Thursday, March 3, 2016 1:43 AM
  • Ok. In short, is there any equivalent Eval() syntax or method in Ms. Word, so that I can execute sth. like:
    Eval("Customfcn1(x,y) & Customfcn2(m,n)")
    Friday, March 4, 2016 9:09 AM
  • >>>Ok. In short, is there any equivalent Eval() syntax or method in Ms. Word, so that I can execute sth. like:
     Eval("Customfcn1(x,y) & Customfcn2(m,n)")<<<

    According to your description, please correct me if I have any misunderstandings on your question, you could use Application.Run method to run a Visual Basic macro, refer to below code:

    Sub DemoEval()
       Debug.Print Application.Run("Add", 12, 10)
    End Sub
    
    Function Add(x As Integer, y As Integer)
      Add = x + y
    End Function
    

    For more information, click here to refer about Application.Run Method (Word)

    Tuesday, March 8, 2016 7:54 AM