Replaces a specified number of characters in a String variable with characters from another string.
Mid( _ ByRef Target As String, _ ByVal Start As Integer, _ Optional ByVal Length As Integer _ ) = StringExpression
The number of characters replaced is always less than or equal to the number of characters in Target.
This example uses the Mid statement to replace a specified number of characters in a string variable with characters from another string.
Dim MyString As String MyString = "The dog jumps" ' Initializes string.Mid(MyString,5,3)= "fox" ' MyString = "The fox jumps".Mid(MyString,5)= "cow" ' MyString = "The cow jumps".Mid(MyString,5)= "cow jumped over" ' MyString = "The cow jumpe".Mid(MyString,5,3)= "duck" ' MyString = "The duc jumpe".