Method: Mid for VBS
- Updated2024-09-12
- 1 minute(s) read
Methods > Method: Mid for VBS
Method: Mid for VBS
Returns a specific number of characters from a text.
vMid = Object.Mid(string, start, [length])
| Object | VBS Object with this method. You do not need to specify this object. |
| string | Variant Specifies the text. |
| start | Variant Specifies the position from where the returned character string starts. If the value is greater than the length of the text, the method Mid returns an empty character string. |
| [length] | Variant Specifies the number of characters to return. If you do not enter the value, or there are less characters in the text than specified, the Mid method returns the whole text from start onwards. |
| vMid | Variant Receives the returned text. |
The following example displays a part of a text:
Dim MyString MyString = Mid("DIAdem is great", 8, 2) Call MsgBox(MyString) ' Returns "is"