简体   繁体   English

Excel VBA 用户表单字体颜色更改

[英]Excel VBA Userform Font color change

I took over a userform from others (this form is made by Excel VBA).我从其他人那里接手了一个用户表单(这个表单是由 Excel VBA 制作的)。 I noticed that guy created two textbox, one's background is in white, another one is in black.我注意到那个家伙创建了两个文本框,一个背景是白色的,另一个是黑色的。 However I want to make all the textbox's background in white but I don't know how to change the font color inside of textbox.但是我想将所有文本框的背景设为白色,但我不知道如何更改文本框内的字体颜色。 I want to change font color into black(like the left textbox) of the right textbox showed below.我想将下面显示的右侧文本框的字体颜色更改为黑色(如左侧文本框)。 Could anyone help me?Thanks a lot!!有人可以帮我吗?非常感谢!!![在此处输入图片说明 ] 1 ] 1

Open the VBA editor and select your textbox.If the properties window on the bottom left of your screen is not visible, hit F4 or select the "View" menu at the top of the editor and select properties window.打开 VBA 编辑器并选择您的文本框。如果屏幕左下角的属性窗口不可见,请按 F4 或选择编辑器顶部的“查看”菜单并选择属性窗口。

With your textbox still selected, the option you need to change the font colour is shown:在您的文本框仍处于选中状态的情况下,将显示您需要更改字体颜色的选项:

在此处输入图片说明

and for the background colour:和背景颜色:

在此处输入图片说明

Both colours can be selected on the colour pickup that pops up when you click on the dropdown arrow next to the property, so you dont need to memorise these values.See below:当您点击属性旁边的下拉箭头时,可以在弹出的颜色拾取器上选择这两种颜色,因此您无需记住这些值。见下文:

在此处输入图片说明

In VBE, when you are in UserForm edition, select the textbox you want to change.在 VBE 中,当您处于 UserForm 版本时,选择要更改的文本框。

You'll find that Properties panel (generally in the bottom left corner of VBE) or right click and Properties您会发现属性面板(通常在 VBE 的左下角)或右键单击和属性

You'll need to change BackColor and ForeColor !您需要更改BackColorForeColor ;) ;)

在此处输入图片说明

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM