Mehmet Gultepe

Detailed file name extraction

Discussion created by Mehmet Gultepe on Sep 25, 2020
Latest reply on Oct 5, 2020 by Deepak Gupta

I made a macro to take only project number and writes it into custom properties but If I could also take part number and part name from file name that would be awesome. 


taking the project number was easy because it is always 6 digits 

sPathName = swModel.GetTitle 'Get File Name & Path
Partnumber = Left(sPathName, 6) 'take part number

Set swCustProp = swModel.Extension.CustomPropertyManager("")
swCustProp.Set "PROJECT #", Partnumber 'write part number in custom properties


I almost want to do remove Left(sPathName - Parnumber - " - ", 2)

and just remove " - " from the rest of it to pull part name but I don't know hot to do that or is it even possible to do?


below is my file name structure.

Project number - part number - part name


200471 - 01 - Tray.sldprt

200471 - 02 - Length Panel.sldprt