Symbol Font Character in VBA String variable?

R

RPJ

Is it possible in VBA to store a Symbol Font (i.e. Wingdings) character
within a String variable?

For example, would it be possible to replace the "?" character in the code
below with a Windings character (like no 34 the "simely face")?

dim A as String
A = "Some ordinary text here, followed by " & "?"

Any help will be much appreciated.

RPJ
 
K

Klaus Linke

RPJ said:
Is it possible in VBA to store a Symbol Font (i.e. Wingdings) character
within a String variable?

For example, would it be possible to replace the "?" character in the code
below with a Windings character (like no 34 the "simely face")?

dim A as String
A = "Some ordinary text here, followed by " & "?"

No... The character code using the Wingdings (Symbol) font would be &HF000 +
74 = &HF04A = 61514. But there's no way to specify the font in the string
variable.

But the smiley face also is contained in lots of regular fonts such as
Arial, and has the code U+263A.
You'd use A = "some text" & ChrW(&H263A)

It's easiest to avoid symbol fonts as much as possible, or put another way,
to use Unicode whenever possible.

Regards,
Klaus
 
R

Russ

You can store almost anything in an autotext entry and use vba code to place
it where you want. To see the code, try recording a macro while inserting an
autotext entry manually and revise the code as needed.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top