简体   繁体   English

如何禁用ActiveX框架?

[英]How can I disable an ActiveX frame?

Within Excel I have three frames, one of these frames contains check boxes. 在Excel中,我有三个框架,其中一个框架包含复选框。 Based upon user selection, I want to be able to enable and disable these ActiveX check boxes, assuming that enabling/disabling the frame would be the most efficient way of doing this I tried the following code: 基于用户的选择,我希望能够启用和禁用这些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

But this disabled all the frames whereas I only want to disable Frame2 , can someone please help? 但这禁用了所有框架,而我只想禁用Frame2 ,有人可以帮忙吗?

This worked: 这工作:

    Dim Ctrl As Control

    For Each Ctrl In Frame2.Controls
         Ctrl.Enabled = False ' Disable the controls
    Next

    For Each Ctrl In Frame2.Controls
         Ctrl.Enabled = True ' Enable the controls
    Next

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM