Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Trim string vII
Ok, next question, how would you keep all the text starting from the right
up until you encounter a "\"? Jesse |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
Trim string vII
One way:
Sub getName() Dim str As String str = "C:\MyWebServer\MyFolder\MyPage.htm" str = Left(str, Len(str) - 4) Dim x As Integer Dim lenStr As Long Dim newString As String lenStr = Len(str) For x = lenStr To 0 Step -1 If Mid(str, x, 1) = "\" Then x = 0 Else newString = Mid(str, x, 1) & newString End If Next Debug.Print newString End Sub -- Michael Hopwood (Phobos) "Jesse Hamilton" wrote in message news:BxSrb.16169$jy.13609@clgrps13... Ok, next question, how would you keep all the text starting from the right up until you encounter a "\"? Jesse |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
Trim string vII
If you use a function from Tom Ogilvy (working in 97-2003)
Function Split97(sStr As Variant, sdelim As String) As Variant Split97 = Evaluate("{""" & _ Application.Substitute(sStr, sdelim, """,""") & """}") End Function Sub test2() Dim fname As String Dim sfname As String Dim varr As Variant fname = "C:\testfile.htm" varr = Split97(fname, "\") sfname = varr(UBound(varr)) MsgBox sfname End Sub -- Regards Ron de Bruin (Win XP Pro SP-1 XL2002 SP-2) www.rondebruin.nl "Jesse Hamilton" wrote in message news:BxSrb.16169$jy.13609@clgrps13... Ok, next question, how would you keep all the text starting from the right up until you encounter a "\"? Jesse |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Trim out last seven characters from a string... | Excel Discussion (Misc queries) | |||
How to trim a string to the last "." | Excel Discussion (Misc queries) | |||
trim a string by specific number of characters | Excel Discussion (Misc queries) | |||
Create a formula into a String then assign string to a cell | Excel Programming | |||
Trim like worksheet Trim | Excel Programming |