Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Greetings All
Could someone help me figure out a working model to trim a file being offered as a string in a URL? Example: strFileUrl = http://www.web.com/doc.doc so that something like strTrimmedURL (variable) would be available? The goal would be for strTrimmedURL to = doc.doc Please advise. J |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
J,
Use the InStrRev function to find the last '/' character, then use Mid to get the remaining portion of the string. E.g., Dim strFileUrl As String Dim TrimmedURL As String Dim Pos As Integer strFileUrl = "http://www.web.com/doc.doc" Pos = InStrRev(strFileUrl, "/") TrimmedURL = Mid(strFileUrl, Pos + 1) Debug.Print TrimmedURL -- Cordially, Chip Pearson Microsoft MVP - Excel Pearson Software Consulting, LLC www.cpearson.com "J" wrote in message ... Greetings All Could someone help me figure out a working model to trim a file being offered as a string in a URL? Example: strFileUrl = http://www.web.com/doc.doc so that something like strTrimmedURL (variable) would be available? The goal would be for strTrimmedURL to = doc.doc Please advise. J |
#3
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Chip
you rock J -----Original Message----- J, Use the InStrRev function to find the last '/' character, then use Mid to get the remaining portion of the string. E.g., Dim strFileUrl As String Dim TrimmedURL As String Dim Pos As Integer strFileUrl = "http://www.web.com/doc.doc" Pos = InStrRev(strFileUrl, "/") TrimmedURL = Mid(strFileUrl, Pos + 1) Debug.Print TrimmedURL -- Cordially, Chip Pearson Microsoft MVP - Excel Pearson Software Consulting, LLC www.cpearson.com "J" wrote in message ... Greetings All Could someone help me figure out a working model to trim a file being offered as a string in a URL? Example: strFileUrl = http://www.web.com/doc.doc so that something like strTrimmedURL (variable) would be available? The goal would be for strTrimmedURL to = doc.doc Please advise. J . |
#4
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
On Tue, 10 Aug 2004 14:04:43 -0700, "J"
wrote: Greetings All Could someone help me figure out a working model to trim a file being offered as a string in a URL? Example: strFileUrl = http://www.web.com/doc.doc so that something like strTrimmedURL (variable) would be available? The goal would be for strTrimmedURL to = doc.doc Please advise. J Perhaps this will give you an idea. Requires later version of Excel with VBA6 ===================== Sub foo() Const strFileUrl As String = "http://www.web.com/doc.doc" Dim Temp Dim strTrimmedURL Temp = Split(strFileUrl, "/") strTrimmedURL = Temp(UBound(Temp)) MsgBox (strTrimmedURL) End Sub ======================== --ron |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Parse A String into Two | Excel Worksheet Functions | |||
parse text string | Excel Worksheet Functions | |||
Parse this string | Excel Discussion (Misc queries) | |||
How to parse a string with a date? | Excel Worksheet Functions | |||
Q: parse string | Excel Discussion (Misc queries) |