My VBA script can save parts in a Solidworks assembly as step files in a specific folder.
I extract the path of my open Solidworks assembly and use that path to save and rename my parts.
A simplified piece of my code:
Set Part = swApp.OpenDoc6("C:UsersUsernameFolder1Folder2Folder3Folder4XXX_0000_XXXXXFolder6Folder7FileName_initial.SLDPRT", 1, 0, "", longstatus, longwarnings)
longstatus = Part.SaveAs3("C:UsersUsernameFolder1Folder2Folder3Folder4XXX_0000_XXXXXFolder6Folder7FileName_0000.STEP", 0, 2)
In my initial pathname, folder5 always consists of the same value: XXX_0000_XXXXX. For example, this can either be ABC_1940_DEFGH or BNM_0529_UGFDB. I want to extract only the number (so 1940 or 0529 in the examples) and use that to rename my file (e.g. FileName_1940.STEP. All files always follow the same pattern. Always three letters, 4 numbers and then 5 letters. Can you please advice me on how to use the assembly-specific 4-coded value?
If anything is not clear, or I need to add more of my code in order to make is more clear, please let me know and thank you in advance.