1

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.

Community
  • 1
  • 1
gherka
  • 1,416
  • 10
  • 17

1 Answers1

0

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

barrowc
  • 10,444
  • 1
  • 40
  • 53
  • If it were so simple, I wouldn't put this on SO - it'd get downvoted into oblivion very quickly. Putting `= "Marlett"` as `Font.Name` has about the same effect as putting `="test"` in, unfortunately. It defaults to Tahoma – gherka Jun 06 '15 at 08:39
  • 1
    Thank you for not abandoning the question after someone (not me) downvoted the answer. I got it to work, but only after putting the font before the caption - as in your answer code. If you have it the other way round, it doesn't work for Marlett, but does for other fonts, like Impact, that I used as a test. Maybe worth asking as a separate question as not very clear why the order would make such a difference. – gherka Jun 07 '15 at 10:03
  • It's the same for me - this code only works if you set the font before setting the caption. No idea why that would be the case. I'll add this to the answer – barrowc Jun 07 '15 at 15:31