Mid Function Description
The VBA Mid function extracts a substring from a given string, based on a given position within the string and a number of characters to extract.
The syntax for the Mid function in VBA is:
MID( text, start_position, no_of_characters )
The string from which you wish to extract from.
The index position in the string that the function is to begin extracting from. The first index position in the string is 1.
The number of characters that you wish to extract.
The Mid function can be used in VBA code. Let’s look at some VBA Mid function examples:
Mid "Hello World!", 6, 6 'Result: "World" Mid "Hello World!", 1, 5 'Result: "Hello"