Can I Evaluate An Excel VB Constant That Is In String Format?

后端 未结 3 2014
隐瞒了意图╮
隐瞒了意图╮ 2020-12-18 12:11

Is it possible to Evaluate a String which contains a valid Excel VB Constant\'s Name to return that Constant\'s Value?

eg

    Dim ConstantName as Str         


        
3条回答
  •  一个人的身影
    2020-12-18 12:24

    Is using the string value necessary?

    Dim anyConstant as Long
    anyConstant = xlValues
    
    msgbox anyConstant
    

    Set anyConstant to any xl constant you please, they are all enumerated Long values.

    The first solution offered is indeed much more fun however.

提交回复
热议问题