带有自定义按钮的 Excel VBA 对话框

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/2202022/
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-11 11:18:26  来源:igfitidea点击:

Excel VBA Dialog box with custom buttons

excelvba

提问by driveguy

I would like to create a dialog box or message box in excel WITH custom button labels i.e. FIRST and SECOND. I would like for this box to open up when the file is first opened...and doesn't allow user access to the worksheet until they select either FIRST or SECOND.

我想在带有自定义按钮标签的 excel 中创建一个对话框或消息框,即 FIRST 和 SECOND。我希望在第一次打开文件时打开这个框......并且在他们选择 FIRST 或 SECOND 之前不允许用户访问工作表。

I can make a form, but I would rather not add a form since this should be simple... I remember doing something very similar back in the VB6 days, but that has been sometime.

我可以制作一个表单,但我宁愿不添加一个表单,因为这应该很简单……我记得在 VB6 时代做过一些非常相似的事情,但那已经是一段时间了。

回答by Lance Roberts

The MsgBox function does not support different names (than the given ones) for the buttons, and neither the InputBox method or function will allow you to change the button names.

MsgBox 函数不支持按钮的不同名称(与给定的名称不同),并且 InputBox 方法或函数都不允许您更改按钮名称。

You'll have to make a simple form.

你必须制作一个简单的表格。