
June 4th, 2003, 07:17 PM
|
 |
Banned ;)
|
|
Join Date: Nov 2001
Location: Woodland Hills, Los Angeles County, California, USA
|
|
Plenty of ways to do this. One way to do this is note that instr has a parameter to specify starting point, so you could call instr to find the first period, then call it again with the position of the first period + 1 as the starting point. This will find the position of the second period and then you can extract the string.
Code:
Dim foo As String
Dim iprange As String
foo = Text1.text
iprange = Left(foo, InStr(InStr(foo, ".") + 1, foo, ".") - 1)
MsgBox iprange
Another way is to use the split function to split the string into an array, using "." as the separator character. After that, it's just a matter of combining the first two array elements.
Code:
Dim foo As String
Dim iprange As String
Dim parts() As String
foo = Text1.text
parts = Split(foo, ".")
iprange = parts(0) & "." & parts(1)
MsgBox iprange
Hope this helps 
|