Monday, January 10, 2005

Inserting Symbol Fonts In A Textbox On A UserForm

— Matt Harris @ 6:28 pm

I recently had cause to develop a UserForm, to be called from Excel, that would allow a user to select a symbol from a group of favorites. Not wanted to use an ActiveX control, I placed 40 textboxes on the form, in rows of 10 each. The idea was I would set the font and character at runtime, reading from a list stored in Excel.

There was a problem. If the font was different from that set at design-time, the symbol would be incorrect, generally showing up as a standard alphanumeric character. After about 2 hours of frustration and searching the web, I found the solution. There is a little documented font property (it wasn’t mentioned in the help files at all) called charset. This property is 0 for normal character sets and needs to be set to 2 for Symbol characters to show up. Example:

Textbox1.Font.Name ="Wingdings"
Textbox1.Font.Charset = 2

Once I did this, the symbols would show up normally.

Comments Off on Inserting Symbol Fonts In A Textbox On A UserForm

Comments are closed.

Archives

  • 1530s Europe Campaign (15)
  • Books (7)
  • BTVS & Angel (24)
  • Cormaria (22)
  • Doctor Who (1)
  • Fanfiction Recs (19)
  • General (36)
  • Harry Potter (19)
  • Humor (16)
  • Java (1)
  • Microsoft Office (2)
  • Northridge Pathfinder (24)
  • OpenOffice.org (1)
  • Pathfinder (30)
  • Politics (4)
  • Programming (6)
  • Programs (5)
  • Reviews (2)
  • Role-Playing Games (D&D et. al.) (85)
  • Science (1)
  • Site News (120)
  • Smallville (2)
  • Stargate (2)
  • Tips (4)




  • Powered by Wordpress