excel - 升级到 Excel 16 时单选按钮参考上的错误消息
问题描述
大家好,感谢您的时间和支持,
我的公司刚刚将我们的 excel 升级到 Excel 365,现在我有一些单选按钮的工作表将无法工作并产生以下错误:
它以前工作得很好,错误发生在下面的第一行代码,三个表单控件单选按钮在一个组框中,任何提示或建议将不胜感激。
Sub Approved_Click()
If ActiveSheet.Shapes("Yearly").ControlFormat.Value = 1 Then
ActiveSheet.Shapes("Scroll Bar 10").Visible = False
解决方案
由于您没有回答我关于控件类型的问题,请尝试下一个代码:
Sub testOptionButtons()
Dim sh As Worksheet
Set sh = ActiveSheet
'for a Form Type use this code:
Debug.Print sh.Shapes("Yearly").ControlFormat.value
'for a ActiveX Type use this code:
Debug.Print sh.Shapes("Yearly").OLEFormat.Object.Object.value
End Sub
或者,如果您不确定它们的类型,请同时测试它们。
推荐阅读
- authentication - WSS 3.0 中嵌入的 ASP.net 4.0 框架应用程序
- amazon-web-services - 如何配置 Amazon S3 存储桶,以便外部供应商可以将每日文件放入该存储桶内的相关文件夹中?
- javascript - Three.JS - GLTF 模型加载缓慢。如何加快加载时间?
- reactjs - 反应钩子的顺序
- python - == 错误 == 解析 YAML 文件时发现异常
- python - 如何计算包含 3 个子列表的 2 个列表之间的曼哈顿距离
- java - 间歇性 NullPointerException 难以重现
- go - go build 可以告诉我哪个文件导致了对包的引用吗?
- php - 如何在 dart 的 Future 函数中从 JSON 创建一个类对象?
- sql - 使用级联删除约束时获取已删除记录的计数