In VBA Excel to print " & Chr(34) & " is used to define ". I have searched and it said 34th character is ", as per this website.

In same way for Thumbs Up Sign the code is

👍 👍

I have tried:

" & Chr(#128077) & "  
" & Chr(128077) & "  
" & Chr(#x1f44d) & "
" & Chr(x1f44d) & "

But it says error as a Syntax error or Expecting ) or Invalid Argument

Can anyone suggest me the solution

1 Answers

2
Sam On

In Excel, characters are stored using Unicode UTF-16. "Thumbs up" corresponds to the Unicode character U+1F44D, encoded as follows:

in UTF-16 (hex) : 0xD83D 0xDC4D (d83ddc4d)

in UTF-16 (decimal) : 55357 , 56397

All those characters which are not the classic latin characters (ASCII) are to be handled with chrW and ascW.

So, in your case

ChrW(55357) & ChrW(56397)
or
ChrW(&HD83D) & ChrW(&HDC4D)

would produce thumbs up. Also note that you won't get that in the VBA IDE. You will have to put it in a worksheet to see it.

Clarification

' Puts a thumbs up symbol in A1
ActiveSheet.Range("A1").Value = ChrW(55357) & ChrW(56397)

' Will not produce a thumbs up symbol, since VBA can't handle it
Debug.Print ChrW(55357) & ChrW(56397)

' Will not produce a thumbs up symbol, since VBA can't handle it
MsgBox ChrW(55357) & ChrW(56397)

HTML
If you want the thumbs up to be in HTML, then do like this:

HtmlString = "<p>something something &#128077;</p>"
Print #1, HtmlString ' <-- replace with your output method

(&#128077; or &#x1f44d;)