如何寻址按钮? (OpenOffice 电子表格宏)
我有一个在 OpenOffice 中启动宏的按钮。 在宏中,我想更改按钮的名称。 Excel 的原始代码是,
ActiveSheet.Shapes("PunchButton").select
Selection.Characters.Text = "Punch In"
但第一行什么也不做。 我已经检查了 OpenOffice 中的工作表,按钮的名称正确。 我怎样才能到达它?
I have a button which launches a macro in OpenOffice. Within the macro, I want to change the name of the button. The original code for Excel is
ActiveSheet.Shapes("PunchButton").select
Selection.Characters.Text = "Punch In"
but the first line does nothing. I've checked the sheet in OpenOffice and the button has the right name. How do I get to it?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
此处有一段代码,展示了如何更改标签和除您想要的按钮之外的所有按钮的状态。
我会修改它以迭代所有按钮,但将内部 if 语句更改为“=”而不是“<>”(如果不需要,则删除禁用)。
There's a snippet of code here that shows how to change the label and state of all buttons but the one you desire.
I would modify this to iterate over all the buttons but change the internal if-statement to '=" instead of "<>" (and remove the disabling if that's not needed).
感谢 Pax,这是我的工作代码。 不确定它有多坚固,但对于有问题的工作表来说它是有效的。 再次感谢,帕克斯。
Thanks to Pax, here's my working code. Not sure how robust it is, but for the sheet in question it works. Thanks again, Pax.