简体   繁体   English

如何在受保护的工作表中更新表单控件标题?

[英]How to update Form Control Caption in a protected worksheet?

I have a form control which I wanted its caption changes between two entries. 我有一个表单控件,希望它的标题在两个条目之间更改。 The worksheet is protected, but even I am changing userinterfaceonly = true and allowing drawingobjects = true it still can not be changed! 工作表受保护,但是即使我更改了userinterfaceonly = true并允许drawingobjects = true也仍然无法更改! is this a bug or I am doing something wrong? 这是一个错误还是我做错了什么? I am trying to avoid uprotect ==> modify ==> protect workaround. 我试图避免uprotect ==>修改==>保护解决方法。

Sub ShowChangesOnly()
Dim ws As Worksheet, Rng As Range, Criteria As Range, Btn As Object
    Set ws = ThisWorkbook.Sheets("Tod")
    ws.Protect , True, , , True, , , , , , , , , True, True
    Set Btn = ws.Buttons("Button 1")
    Set Rng = ws.Range("TodayD")
    Set Criteria = ws.Range("Criteria")
    RemoveFilters ws
    If Btn.Caption = "Filter Changes" Then
        Rng.AdvancedFilter xlFilterInPlace, Criteria
        Btn.Caption = "Show All"
        MsgBox "Total of " & Rng.Columns(3).SpecialCells(12).Count - 1 &  _
          " Found as Having Changes."
        Else
            Btn.Caption = "Filter Changes"
        End If
    End Sub

Thanks in advance. 提前致谢。

Cheers, 干杯,
M 中号

you want drawing objects to be false, 您希望绘图对象为假,

From help : True to protect shapes. The default value is True. 来自帮助: True to protect shapes. The default value is True. True to protect shapes. The default value is True.

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

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