vba Excel 命令按钮名称更改

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/28230436/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-12 06:03:07  来源:igfitidea点击:

Excel CommandButton names changing

excelvbacommandbutton

提问by Tobias Peter

I created an excel file with macros on ActiveX-CommandButtons. They worked well, when I just finished them. As soon as I opened the file again, the CommandButton-Names changed.

我在ActiveX-CommandButtons上创建了一个带有宏的 excel 文件。当我刚刚完成它们时,它们运行良好。一旦我再次打开文件,CommandButton-Names 就改变了



As example:

例如:

CommandButton1 changed to CommandButton2

命令按钮 1 更改为命令按钮 2

CommandButton2 changed to CommandButton3 etc.

CommandButton2 更改为 CommandButton3 等。



I didn't found anything in my reasearch, so is this an excel bug or just something that you can change in your preferences?

我在我的研究中没有发现任何东西,所以这是一个 excel 错误还是只是你可以改变你的偏好的东西?

回答by Avidan

Right click on CommandButton

右键单击命令按钮

Go to (click on) 'Format Text Effects'

转到(单击)“格式文本效果”

Give the name to button, whichever you want.

为按钮命名,无论您想要什么。

Save it.

保存。

Close the workbook.

关闭工作簿。

Open it back and check whether name changes

重新打开并检查名称是否更改

(No need to enable 'Design Mode')

(无需启用“设计模式”)

It works for me. Hope it shall work for you too.

这个对我有用。希望它也适用于你。

If it do not work then please let me know.

如果它不起作用,请告诉我。

For more info: https://support.office.microsoft.com/en-in/article/Add-a-button-and-assign-a-macro-to-it-in-a-worksheet-d58edd7d-cb04-4964-bead-9c72c843a283?CorrelationId=345214f6-6d01-4b07-994b-b2e33159e694&ui=en-US&rs=en-IN&ad=IN

欲了解更多信息:https: //support.office.microsoft.com/en-in/article/Add-a-button-and-assign-a-macro-to-it-in-a-worksheet-d58edd7d-cb04- 4964-bead-9c72c843a283?CorrelationId=345214f6-6d01-4b07-994b-b2e33159e694&ui=en-US&rs=en-IN&ad=IN