Search code examples
vbaexcelcharacterimacros

"→"-Character in Office 2013 Excel VBA not copyable into Code


I'm currently programming a VBA Code for iMacros, therefore I need to have the following string:

TAG POS=1 TYPE=BUTTON:SUBMIT ATTR=TXT:Find<SP>Facebook<SP>ID<SP>→

but, if I copy this code into the VBA Code Editor in Excel 2013, I get the following:

TAG POS=1 TYPE=BUTTON:SUBMIT ATTR=TXT:Find<SP>Facebook<SP>ID<SP>?

The character is not readable for VBA and rewrites it as a ?

I would use the string like this in my code, to send it to iMacros:

  macro = macro + "TAG POS=1 TYPE=BUTTON:SUBMIT ATTR=TXT:Find<SP>Facebook<SP>ID<SP>→" + vbNewLine

How can I still send the right string to iMacros?

I tried to add the character as a Hexadecimal number to add it to the string, but didn't figure really out how it could work..

Do you have any idea how I can use the character in VBA?


Solution

  • Simply use:

    macro = macro + "TAG POS=1 TYPE=BUTTON:SUBMIT ATTR=TXT:Find<SP>Facebook<SP>ID<SP>" & ChrW(8594) & vbNewLine
    

    ;)

    Hint: The "compiler" simply does not support double byte characters (still they can be inside a string). And ChrW(8594) is . If you get problems with other chars, you can use ?AscW(Range(#)) (# is the cell that has that character at the first position) to get the code for ChrW() to recreate it.