Mid / MidB

Function Declaration

 Function Mid(String As Variant, Start As Long, Optional 
 Length As Variant) As Variant 




String expression from which characters are returned. If String contains the data value Null, Null is returned.


Long containing the character position in String at which the part to be taken begins. If Start is greater than the number of characters in String, Mid returns a zero-length string ("").


Long containing the number of characters to return. If omitted or if there are fewer than Length characters in the text (including the character at start), all characters from the start position to the end of the string are returned.

Runtime Semantics.

§ Returns a String containing a specified number of characters from a string.

§ To determine the number of characters in String, use the Len function.

§ Note: use the MidB function with byte data contained in a string, as in double-byte character set languages. Instead of specifying the number of characters, the arguments specify numbers of bytes.