AnsweredAssumed Answered

Run macro on all *.SLDLFP files in a directory, including subdirectories.

Question asked by Jack Berryman on May 20, 2013
Latest reply on May 21, 2013 by Jack Berryman

Hi All,


How do I go about running the following macro on all *.SLDLFP files in the weldment profile directory - including all files in all subfolders.



Dim swApp As SldWorks.SldWorks
Dim modelDoc As SldWorks.ModelDoc2

 Sub main()
Dim cusPropMgr As SldWorks.CustomPropertyManager
Dim retDetails As String
Dim retDescription As String
Dim retval As Integer
Set swApp = Application.SldWorks
Set modelDoc = swApp.ActiveDoc
Set cusPropMgr = modelDoc.extension.CustomPropertyManager("")
'with this code you add a new custom property
retDescription = cusPropMgr.Get("Description")
retval = cusPropMgr.Add2("Details", swCustomInfoText, retDescription)
retval = cusPropMgr.Set("Details", retDescription)
'if you want to change an existing custom property use the code below
'retval = cusPropMgr.Set("New Number", "9")
End Sub


Thank you all so much in advance!