在VBA(Microsoft Access)中将标签的“标题"属性的一部分加粗 [英] Bold a portion of a Label's `Caption` property in VBA (Microsoft Access)
问题描述
如何在Microsoft Access标签的标题中加粗某个单词?
How do I bold a certain word in the caption of a Microsoft Access label?
如果有帮助,文本本身将存储在Microsoft Access表中.
If it helps, the text itself is stored in a Microsoft Access table.
下面是一个示例.我有一个带有标签的Microsoft Access表单,在Form_Load()
事件中,我将此标签的标题属性设置为DLookup查询中返回的值,如下所示:
An example is below. I have a Microsoft Access form with a label, in the Form_Load()
event I set the caption property of this label to the value returned in a DLookup query like so:
Private Sub Form_Load()
Me.Label0.Caption = DLookup("Field1", "Table1", "[ID] = 1")
End Sub
我的文字如下:
快速的棕色狐狸跳过了那只懒狗
The quick brown fox jumps over the lazy dog
我要加粗 Lazy (懒惰)一词.这可能吗?如果是这样,我该怎么办?
I want to embolden the word Lazy. Is this possible? If so, how do I do this?
谢谢
推荐答案
您没有提到Access的版本,对于2007(AFAIK)和2010,您可以创建一个文本框并将数据"选项卡上的文本格式"设置为丰富"文本.然后,您可以将控制源设置为:
You do not mention the version of Access, for 2007 (AFAIK) and 2010, you can create a textbox and set the Text Format on the data tab to Rich Text. You can then set the Control Source to:
="The quick <b>brown</b> fox"
再更改一些属性,例如锁定"和已启用",您将拥有一个外观和行为类似于标签的文本框.
Change a few more properties, such as Locked and Enabled and you will have a textbox that looks and acts like a label.
这篇关于在VBA(Microsoft Access)中将标签的“标题"属性的一部分加粗的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!