Login | |
|
 |
RE: Capturing text on a line - 2/23/2006 12:37:59 AM
|
|
 |
|
| |
Fredledingue
Posts: 383
Score: 0
Joined: 5/9/2005
From:
Status: offline
|
MyString = "2006/02/21 00:51:35 ERROR 33 (0x00000021) Copying File G:\SHAR " ErrorNumber = Mid(MyString, InStr(MyString,"ERROR")+6 , InStr(MyString,"(" ) - (InStr(MyString,"ERROR")+6) )
_____________________________
Fred
|
|
| |
|
|
|
 |
RE: Capturing text on a line - 2/23/2006 11:27:46 AM
|
|
 |
|
| |
Fredledingue
Posts: 383
Score: 0
Joined: 5/9/2005
From:
Status: offline
|
Yes, splitting a string is sometimes easier to figure out than the InStr and Mid that I used. Note: tempText = split(mid(strLine, intErrorCounter, 20), " ") ' message = message + "Error " & tempText(1) & " found on line " & intLineNum & chr(13) can be rewritten 1/ message = message + "Error " & split(mid(strLine, intErrorCounter, 20), " ") (1) & " found on line " & intLineNum & VbCrlf If you don't need to keep the array for other things. 2/ You can write VbCrlf instead of chr(13)
_____________________________
Fred
|
|
| |
|
|
|
|
|