|
-
Sep 21st, 2007, 03:40 PM
#7
Thread Starter
Hyperactive Member
Re: Is there something in brackets?
 Originally Posted by Mxjerrett
Here it is with basic error handling.
Code:
Public Function GetText(Text As String) As String
Dim lngStart As Long
If Trim(Text) = "" Then MsgBox ("Error: No text."), vbInformation, "Error": Exit Function
If InStr(1, Text, "[") = 0 Or InStr(1, Text, "]") = 0 Then MsgBox ("Error: No text in brackets."), vbInformation, "Error": Exit Function
lngStart = InStr(1, Text, "[")
GetText = Mid(Text, lngStart + 1, InStr(lngStart, Text, "]") - lngStart - 1)
End Function
Nice! But if TextBox = "][" then we will get "Run-time error '5' "
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|