CallByName mnuFile, "Enabled", VbLet, False
CallByName mnuFile, "Enabled", VbLet, True

解决方案 »

  1.   

    可能我说的不清楚比如:dim str_mnuObj as stringstr_mnuObj="mnuFile"现在我想用str_mnuObj这个变量设置mnuFile这个对象的enable属性?注:mnuFile是菜单对象如何用str_numOjb实现
    mnuFile.Enable=False
    这句话同样的功能?
      

  2.   

    Dim c As New Collection
    Private Sub Command1_Click()
        Dim d As Object
        Dim f as Boolean
        For Each d In c
            If d.Name = "mnuFile" Then f = True:Exit For
        Next
        if f then CallByName d, "Enabled", VbLet, False
    End SubPrivate Sub Form_Load()
        c.Add mnuFile
    End SubPrivate Sub Form_Unload(Cancel As Integer)
        Set c = Nothing
    End Sub
      

  3.   

    CallByName mnuFile, "Enabled", VbLet, False
    等同于
    mnuFile.enabled=false