Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How can I extract a portion of a string 1

Status
Not open for further replies.

PleaseGiveHelp

Programmer
Oct 29, 2002
131
0
0
US
I am reading in a file name and I want to extract a piece of the file name. So if the filename is C:\Test\Test2\1234_Jingle[1].2_Done.csv, I only want the portion between the "-" and the "[". I believe I've done this within VB before but I cannot remember how. What function can I use to extract the piece? None of the truncation/trim functions allow me to travel to a character. Help!
 
Try
[blue][tt]
theString = Mid$(filename,
Instr(filename,"_") + 1,
Instr(filename,"[") - Instr(filename,"_")-1)
[/tt][/blue]
 
Read up on the SPLIT Function in the VB Help

Let me know if this works for you
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top