Bob
Mon Jun 18 13:45:40 CDT 2007
Nope. I changed my mind at the last second and used Split instead.
Slightly less complicated than using InStr. Off the top of my head, it
would look like this:
strpath=Mid(strpath,3, Instr(3,strpath,"\") - 3)
You can look up the purpose of the 4th argument in online help:
http://www.microsoft.com/downloads/details.aspx?FamilyID=01592c48-207d-4be1-8a76-1c4099d7bbb9&DisplayLang=en
S Moran wrote:
> thanks... you said instr takes up to 4 args, then you didnt use instr
> in your example. did i miss something?
>
>
> "Bob Barrows [MVP]" <reb01501@NOyahoo.SPAMcom> wrote in message
> news:eA9cqBdsHHA.1216@TK2MSFTNGP04.phx.gbl...
>> S Moran wrote:
>>> have the following:
>>>
>>> strPath = "\\server\folder\folder"
>>> strPath = Mid(strPath, 3)
>>> strPath = Mid(strPath, 1, InStr(strPath, "\") - 1)
>>> Wscript.Echo strPath
>>>
>>> obviously what im doing is plucking out only the server name from
>>> the unc path.
>>> is there no way i could do this with one statement instead of 2?
>>
>> What you have there works, does it not? What's the problem? It's not
>> like you're going to get a huge performance boost by whittling this
>> down to a single line.
>>
>> However, Instr takes up to 4 arguments. Try this:
>>
>> strPath = "\\server\folder\folder"
>> strpath = split(strpath,"\")(2)
>>
>> There's probably a regular expression that could do this as well ...
>>
>> --
>> Microsoft MVP -- ASP/ASP.NET
>> Please reply to the newsgroup. The email account listed in my From
>> header is my spam trap, so I don't check it very often. You will get
>> a quicker response by posting to the newsgroup.
--
Microsoft MVP -- ASP/ASP.NET
Please reply to the newsgroup. The email account listed in my From
header is my spam trap, so I don't check it very often. You will get a
quicker response by posting to the newsgroup.