Introduction to escape routes

While the program is running, you may need to view certain information or ask a question. For example:

  1. If the Support Ticket has been issued, we will receive the ticket number after clicking the Submit button. With the number we also receive a message of the type Leave this number for later use. You will receive an answer within 6 days.
  2. We may receive a message when we file an income tax return: Your statement has been successfully submitted. And then a few more instructions.
  3. At the time of filling in the form, we may receive instructions from the rejection / error message indicating the intended password structure or mandatory fields.

These messages are dynamic or hard-coded character strings printed between quotation marks.

Examples :

1. Your user ID is RAD00234.

2. Maximum number of invalid login attempts on a specific bank account.

Your account is blocked for security reasons.

Please contact your desk to unblock your account.

Lines are usually represented by double quotes. In the first example above, the value of the user ID is in quotation marks. This means that the first double quotes – those for the user ID – indicate the end of this string. So, can you guess how you represent this whole sentence, the double quotes and all that?

In the second example, you see that there are three sentences, each beginning a new line?

This is an escape character that you use to display the text this way. The shield character(s) help the following character(s) by interpreting the programming language differently from the default behavior.

Unicity in VBA

In programming languages, a backslash is usually used as an escape character.

Example: n for a new line, t for a tab space.

But in VBA we use a function called chr((). This built-in function returns the equivalent ASCII value of the parameter.

Syntax:

XR()

The number can be any number from 0 to 127.

This function returns the corresponding ASCII value from the table below.

ASCII Table

December Hex Binary HTML Balloon Description
0 0 0   ZERO Zero
1 1 1 SOH Title
2 2 10 STX Beginning of the text
3 3 11 ETX End of the text
4 4 100 EOT End of transfer
5 5 101 ENQ Ask for it.
6 6 110 ACK Recognize.
7 7 111 BEL Call
8 8 1000 BS Backspace key
9 9 1001   HT horizontal tabulation
10 0A 1010   LF Linear power supply
11 0B 1011 VT Vertical identification plate
12 0C 1100 FF Feeding form
13 0D 1101   CR Return of the car
14 0E 1110 SO Disable
15 0F 1111 SI Travelling in
16 10 10000 DLE Escape via a data channel
17 11 10001 DC1 Control unit 1
18 12 10010 DC2 Device control 2
19 13 10011 DC3 Control unit 3
20 14 10100 DC4 Control unit 4
21 15 10101 NAK Negative recognition
22 16 10110 SYN Sync
23 17 10111 ETB End of transmission unit
24 18 11000 CAN Cancel.
25 19 11001 EM End of Wednesday
26 1A 11010 SUB Replace it.
27 1B 11011 CES Escape
28 1C 11100 FEASIBILITY STUDY File separator sign
29 1D 11101 GS Group separator
30 1E 11110 RS Recording separator
31 1F 11111 UNITED STATES Unit separator
32 20 100000   Location Space
33 21 100001 ! ! Exclamation mark
34 22 100010 quotes
35 23 100011 # # Number
36 24 100100 $ $ The dollar sign
37 25 100101 % % Percentage share
38 26 100110 & & Amps and
39 27 100111 Single quotation
40 28 101000 ( ( Left hooks
41 29 101001 ) ) Right hooks
42 2A 101010 * * Asterisk
43 2B 101011 + + More.
44 2C 101100 , , comma
45 2D 101101 Less than .
46 2E 101110 . . Period
47 2F 101111 / / Slash
48 30 110000 0 0 Zero
49 31 110001 1 1 A
50 32 110010 2 2 Two
51 33 110011 3 3 Three
52 34 110100 4 4 Celebrate
53 35 110101 5 5 Five
54 36 110110 6 6 Six
55 37 110111 7 7 Sept.
56 38 111000 8 8 Eight
57 39 111001 9 9 New
58 3A 111010 : : Colon
59 3B 111011 ; ; Semikolon
60 3C 111100 < < Less than
 
61 3D 111101 = = mark of equality
62 3E 111110 > > More than…
63 3F 111111 ? ? Question mark
64 40 1000000 @ @ On a signal
65 41 1000001 A A Uppercase letters / Uppercase A
66 42 1000010 B B Uppercase letter / Uppercase letter B
67 43 1000011 C C Uppercase / Uppercase C
68 44 1000100 D D Uppercase / Uppercase D
69 45 1000101 E E Top/bottom cabinet E
70 46 1000110 F F Top/bottom cabinet F
71 47 1000111 G G Top/bottom cabinet G
72 48 1001000 H H Capital H
73 49 1001001 I I Upper/lower case I
74 4A 1001010 J J Heading / Uppercase J
75 4B 1001011 K K Uppercase / Uppercase K
76 4C 1001100 L L Header / Uppercase L
77 4D 1001101 M M Top/bottom cabinet M
78 4E 1001110 N N Uppercase / Uppercase N
79 4F 1001111 O O Upper/lower case O
80 50 1010000 P P Uppercase P
81 51 1010001 Q Q Capital / Superior case Q
82 52 1010010 R R Uppercase letters / Uppercase R
83 53 1010011 S S S upper/lower cabinet
84 54 1010100 T T Upper/lower case T
85 55 1010101 U U Uppercase / Uppercase U
86 56 1010110 V V Top/bottom cabinet V
87 57 1010111 W W Header / Uppercase W
88 58 1011000 X X Header / Uppercase X
89 59 1011001 Y Y Uppercase / Uppercase Y
90 5A 1011010 Z Z Uppercase / Uppercase Z
91 5B 1011011 [ [ Left hook
92 5C 1011100 \   Reverse slash
93 5D 1011101 ] ] Right hook
94 5E 1011110 ^ ^ Caretta/circumflex
95 5F 1011111 _ _ More information
96 60 1100000 ` ` Grave / Accent
97 61 1100001 a a Lower case a
98 62 1100010 b b Lower hull b
99 63 1100011 c c Lower hull c
100 64 1100100 d d Lower fuselage d
101 65 1100101 e e lowercase letter e
102 66 1100110 f f Lower fuselage f
103 67 1100111 g g Lower fuselage g
104 68 1101000 h h Lower shell
105 69 1101001 i i Lower shell i
106 6A 1101010 j j Lower fuselage j
107 6B 1101011 k k Lower fuselage k
108 6C 1101100 l l Lower shell l
109 6D 1101101 m m Lower fuselage m
110 6E 1101110 n n Ground cover n
111 6F 1101111 o o Lower case o
112 70 1110000 p p Lower case P
113 71 1110001 q q lower case q
114 72 1110010 r r Lower fuselage r
115 73 1110011 s s Lower hull s
116 74 1110100 t t Lower hull t
117 75 1110101 u u Lower case U
118 76 1110110 v v Lower fuselage v
 
119 77 1110111 w w Lower fuselage w
120 78 1111000 x x Lower shell x
121 79 1111001 y y Lower shell y
122 7A 1111010 z z Lower case Z
123 7B 1111011 { { Left hook
124 7C 1111100 | | Vertical bar
125 7D 1111101 } } Right hooks
126 7E 1111110 ~ ~ Tilt
127 7F 1111111  DEL delete

Escaping double quotes

To display double quotes in a string, we must use double quotes twice in a row. So you must use quotation marks to avoid double quotes.

Below I will also show you how to use the Chr() function to produce a bow ribbon, the # and % characters.

For example:

Under demo_escape()

see number
Debug.print I like to drink tea
Troubleshooting. Print that I like tea.

Troubleshooting. I print that I live in England.
Troubleshooting. I print that I live in England.

Chris(10) is the equivalent of a new line. The two sets are combined here.
Troubleshooting. Print it. I got promoted. What about you?
Troubleshooting. Busy. I got promoted. What about you?

Debug.print Chr(35) & Issue
Debug.print Chr(37) & Interest

Last sub-heading

alt=VBA data-orig-width=960 data-orig-height=540 data-ezsrc=http://server.digimetriq.com/wp-content/uploads/2020/12/Guide-to-Escape-Characters-in-VBA.png data-ez= />.

alt=Plug in! data-ezsrc=/utilcave_com/social/pin_it.png />

alt=Change to Facebook data-ezsrc=/utilcave_com/social/fb_share.png />

Conclusion

The shielding symbol is very useful to display lines or messages the way we want to display them. As an automation specialist, I have come across situations in which a website needs to identify unknown characters. The built-in Chr() function is very useful for me in situations as complicated as this one.

I have used it a lot in my coding because of its power and reliability. VBA has certainly simplified the use of escape characters by introducing a function that uses the ASCII table. Last bonus tip – there is an ASCII() function that can be used to return the ASCII number (Dec) from the table above.

vba escape character backslash,escape code vba,vba escape for,excel vba escape key,vba escape character single quote,vba special characters,vba parentheses in string,vba square brackets in string,vba regex capture group,vba regex late binding,vba regex multiple patterns,vba regex extract,vba matchcollection,regex replace vba,vba quotation marks in formula,vba single quote in string,apostrophe vba sql insert statement,vba sql escape string,vba remove quotes from string,vba quotation marks character,vba string manipulation,vba get string after character,vba string concatenation,vba instr alternatives,vba string variable,excel vba find character in string from left,visual basic special characters,vba special characters in string,unicode to vba,visual basic labels,visual basic type characters,identifiers in visual basic,excel vba remove specific text from cell,vba remove last character from string,vba replace function,vba find character in string,vba remove special characters from string,excel vba escape special characters,vba escape single quote,vba characters,vba space character,vba foreign characters,vba escape underscore

You May Also Like

How to remove lock screen ads on Android

As necessary as advertising and marketing communications are, the implementation methodology can…

How to Check if an Array Is Empty in VBA

When a list or set of elements with the same type of…

7 Solutions To Fix Chromium Won’t Uninstall In Windows 10

Chromium is an open source web browser developed by Google. Thanks to…

🥇 Discord Nitro  What is it? + Benefits and Prices ▷ 2020

If you consider yourself a gamer, or if you spend a lot…