VBA/Excel/Access/Word/String Functions/Mid
Mid() returns Any portion of a string
<source lang="vb">
Sub midDemo()
Dim userName As String Dim firstName As String Dim spaceLoc As Integer Dim strLength As Integer Dim lastName As String userName = " First Last" spaceLoc = InStr(1, userName, " ") firstName = Left(userName, spaceLoc - 1) strLength = Len(firstName) lastName = Mid(userName, 1, 5) Debug.Print lastName
End Sub
</source>
Mid() Returns a substring from inside a string.
<source lang="vb">
Sub strDemo7()
Debug.Print Mid("Test", 2, 2)
End Sub
</source>