如何禁用ActiveX框架?

时间:2015-11-24 16:58:27

标签: excel vba checkbox activex frame

在Excel中我有三个框架,其中一个框架包含复选框。根据用户选择,我希望能够启用和禁用这些ActiveX复选框,假设启用/禁用框架是最有效的方法,我尝试了以下代码:

Dim oOle As OLEObject, ws As Worksheet
For Each ws In Worksheets
   For Each oOle In ws.OLEObjects
       oOle.Enabled = False
   Next oOle
Next ws

但这会禁用所有相框,而我只想禁用Frame2,有人可以帮忙吗?

1 个答案:

答案 0 :(得分:0)

这有效:

<script>
    var inspiration = document.getElementsByClassName("inspiration");
    var expandMenu = function() {
        var recipe = document.getElementsByClassName("recipe");
        var CSSprop = window.getComputedStyle(recipe,null).getPropertyValue("visibility");
        if(CSSprop == "visible"){
            recipe[0].style.visibility = "hidden";
        }else {
            recipe[0].style.visibility = "visible";
        }
    }
    inspiration[0].addEventListener("click", expandMenu);
</script>