VBA UserForm - label caption font is not being set

On a UserForm I have a label control where I want to put the caption 'right arrow symbol'. That would be   ¶ in the font Wingdings 3

I used this code

   
Dim cCont4 As Control

Open in new window


and looping over items in an array, with index i
  
        Set cCont4 = Frame1.Controls.Add("Forms.Label.1", "CopyOf")

      With cCont4
            .Caption = "¶"
            .Font.Name = "Wingdings 3"
            .AutoSize = True
            .Top = i * 22
            .Left = 390
            .Width = 60
            .Name = "lblPreview" & arrSections(1, i)
        End With

Open in new window


The Font isn't being set to "Wingdings 3"

I can't figure out why that is. Tried other fonts also. Still shows "¶"

What am I doing wrong?
Thanks
hindersalivaAsked:
Who is Participating?
 
Martin LissOlder than dirtCommented:
There are several values that will give you a right arrow in Wingdings 3 and two of them are 'a' and 'g'. Make sure you put the setting of the font name prior to the setting of the character.
            .Font.Name = "Wingdings 3"
            .Caption = "g"

Open in new window

0
 
NorieVBA ExpertCommented:
Can you add such a label manually when in design view?
0
 
hindersalivaAuthor Commented:
Yes, Norie.
0
Get your problem seen by more experts

Be seen. Boost your question’s priority for more expert views and faster solutions

 
NorieVBA ExpertCommented:
What happens if you use Chr(34) instead of "¶"?
 Set cCont4 = Frame1.Controls.Add("Forms.Label.1", "CopyOf")

 With cCont4
     .Caption = Chr(34)
     .Font.Name = "Wingdings 3"
     .AutoSize = True
     .Top = i * 22
     .Left = 390
     .Width = 60
     .Name = "lblPreview" & arrSections(1, i)
End With

Open in new window

0
 
hindersalivaAuthor Commented:
Norie, that works!
So what is Chr() for right arrow?
Sample of arrow
0
 
NorieVBA ExpertCommented:
I looked up right arrow in a WingDings 3 character set and it gave me Chr(34), is that not the one you want?
0
 
hindersalivaAuthor Commented:
Chr(34) gives me " (double quotes)
0
 
NorieVBA ExpertCommented:
I think Martin might have spotted something there with setting the font before caption.
0
 
hindersalivaAuthor Commented:
That's great Martin!
The 'a' gives me a hollow right arrow. Any way for a solid one?

Doesn't work with "¶" though/
0
 
Martin LissOlder than dirtCommented:
I get this (using .Font.Size = 36)
Cursor_and_UserForm1.jpg

But go here.
0
 
Martin LissOlder than dirtCommented:
Edit: I used g.
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.