ds-blue-logo
Preview  |  SOLIDWORKS USER FORUM
Use your SOLIDWORKS ID or 3DEXPERIENCE ID to log in.
MGMehmet Gultepe26/09/2020

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