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 cowski on being selected by the Eng-Tips community for having the most helpful posts in the forums last week. Way to Go!

Modifying a String 1

Status
Not open for further replies.

Creigbm

Mechanical
Joined
Aug 1, 2003
Messages
161
Location
US
I am not sure if there is a way to accomplish this, but I am trying to get the title of a document by knowing the filename. For example, I have this filename:

C:/fdfd/fdfdse/sfsf/PART.dwg

Is there a way to 'get rid of' eveything in the string except for the PART.dwg? Note that the length of the string is ever changing so I cannot hard code it to subtract 20 characters from the left. Thanks in advance for any help.
 
Depending on which version of VBA you have, you may have at your disposal the InStrRev function. If so, you can use that to locate the last slash -- forward slash and back slash are not the same character -- and from that location, use the mid function to extract the balance of the string.
 
Thanks, I will give that a try.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top