将自定义控件添加到工具箱Add a customized control to the Toolbox

  1. 在窗体上放置一个控件并对该控件进行自定义。Place a control on your form and customize it.

  2. 例如, 若要创建 "确定" 按钮, 请将**命令按钮** 放置在窗体上, 将其**Caption** 属性设置为 "确定" , 并将其默认属性设置为TrueFor example, to create an OK button, place a CommandButton on the form, set its Caption property to OK and set its Default property to True.

  3. 选择该自定义控件。Select the customized control.

  4. 将控件拖动到**工具箱**。Drag the control to the Toolbox.

备注

[!注释] 在将一个控件拖动到工具箱中时,仅转移属性值。When you drag a control onto the Toolbox, you only transfer property values. 您已为该控件编写的任何代码不会随该控件一起转移。Any code you have written for that control does not transfer with the control. 您必须为图标编写新代码或将代码从窗体上的控件中复制到工具箱中的控件。You must write new code for the icon or copy code from the control on the form to the control on the Toolbox.

另请参阅See also

支持和反馈Support and feedback

有关于 Office VBA 或本文档的疑问或反馈?Have questions or feedback about Office VBA or this documentation? 请参阅 Office VBA 支持和反馈,获取有关如何接收支持和提供反馈的指南。Please see Office VBA support and feedback for guidance about the ways you can receive support and provide feedback.