Is it possible to print a padlock symbol (open & closed) in a cell with Chr()
, ChrW()
or something similar through VBA?
相关问题
- Excel sunburst chart: Some labels missing
- Error handling only works once
- Error handling only works once
- Excel formula in VBA code
- Excel VBA run time error 450 from referencing a ra
相关文章
- Get column data by Column name and sheet name
- programmatically excel cells to be auto fit width
- Unregister a XLL in Excel (VBA)
- Unregister a XLL in Excel (VBA)
- How to prevent excel from truncating numbers in a
- numeric up down control in vba
- Declare a Range relative to the Active Cell with V
- What's the easiest way to create an Excel tabl
It seems that Excel stores special chars as UTF-16. As long as you have a code that fits within 16bit, it's easy: Just convert the code using function
ChrW
. For example, the code for an alarm clock is U+23F0, so you can writeActiveCell.Value = ChrW(&H23F0)
and you get your alarm clock (the prefix&H
defines a hexadecimal number).However, when you have characters that doesn't fit into these 16bit, you have to figure out the UTF-16 codes and concatenate them. The locks I found are
U+1F512
andU+1F513
, and their UTF-16 representatives are 0xD83D 0xDD12 resp. 0xD83D 0xDD13. So you write something likeOf course, you need to set a font to the cell that supports these characters.
I found http://www.fileformat.info/info/unicode/char/search.htm helpfull to find matching characters. If you have already a character and you can paste it into a cell, you can use the code I've written in this answer: https://stackoverflow.com/a/55418901/7599798
You need to add a unicode symbol. The following code will add a lock or unlock symbol in cell 1,1.
You can use the "Add Symbol" button in the "Insert" ribbon to look for other symbols in different fonts.