例如这样一个函数:
Sub ttt()
    MsgBox "hello"
End SubSub yyy
    Const t as string = "ttt"
    '这里用什么语句掉用t,来执行ttt过程
End Sub

解决方案 »

  1.   

    记得 CSDN 上有帖子是利用 Microsoft Scripting 对像实现。
      

  2.   

    用callbyname即可,不过需要注意的是Sub ttt()必须声明为public
      

  3.   


    Sub ttt()
        MsgBox "hello"
    End SubSub yyy
        ttt
    End Sub
      

  4.   

    Private Declare Function EbExecuteLine Lib "vba6.dll" (ByVal pStringToExec As Long, ByVal Unknownn1 As Long, ByVal Unknownn2 As Long, ByVal fCheckOnly As Long) As LongSub ttt()
        MsgBox "hello"
    End SubSub yyy
        Const t as string = "ttt"
        Call EbExecuteLine(StrPtr(t), 0&, 0&, 0&)
    End Sub
      

  5.   

    赞同 rainstormmaster(暴风雨 v2.0) 老大Sub ttt()
        MsgBox "hello"
    End SubSub yyy()
        Const t As String = "ttt"
        CallByName Me, t, VbMethod '这里用什么语句掉用t,来执行ttt过程
    End Sub
      

  6.   

    用EbExecuteLine函数好象不能脱离IDE环境