Hi All,
I have started to write a macro to rename the Cut-List folder. The folder to be renamed by prefix defined as an Input followed by numbers 001,002 and so on..
The code is below. At the moment, I cannot get this code to go through all the folders and does work only for the first folder. I was wondering if someone could help me on that.
Sub main()
Set swApp = Application.SldWorks
Set Part = swApp.ActiveDoc
Set SelMgr = Part.SelectionManager
Part.ClearSelection2 True
boolstatus = Part.Extension.SelectByID2("Cut-List-Item1", "SUBWELDFOLDER", 0, 0, 0, False, 0, Nothing, 0)
Dim prefixName As String
Dim foldercount As Integer
foldercount = 1
prefixName = InputBox("Enter a prefix for the cut-list folder names")
SelMgr.GetSelectedObject5(1).Name = prefixName + IIf(foldercount < 10, "00" + CStr(foldercount), IIf(foldercount < 100, "0" + CStr(foldercount), CStr(foldercount)))
foldercount = foldercount + 1
End Sub
Regards,
Salman
SolidworksApi macros