Search code examples
excelfontsobject-propertiesvba

Marlett font missing from VBA object properties


I want to place a green tick mark on a userform and thought that creating a label with the caption "a" in Marlett font would do the trick. However, Marlett isn't showing up in the object properties despite definitely being installed. I can easily place the tick mark in a cell, but not in a label. Is there a way to enable it for userforms?

There is an answer to the same problem in the c# section - How do I set button font to Marlett, but I'm not sure if it can be applied to VBA as well.


Solution

  • It's as simple as putting:

    Label1.Font.Name = "Marlett"
    Label1.Caption = "a"
    

    (important: this code only seems to work if you set the font before setting the caption; setting the caption first seems to prevent setting the font from having an effect - thanks to @N.N.Thoughts for the info)

    in the Userform_Initialize event of your userform. Replace Label1 with the name of the actual control

    edit: with the addition of code to set the font size and colour:

    Label1.Font.Size = "32"
    Label1.ForeColor = RGB(0, 255, 0)
    

    enter image description here