AnsweredAssumed Answered

Api Macro to add Folders and subfolders in an assembly

Question asked by Joe Pickens on Feb 27, 2016
Latest reply on Feb 27, 2016 by Deepak Gupta

I am trying to create a folder in an assembly and the create a sub-folder in that folder. How do I add a subfolder into a folder



Option Explicit


Dim swApp           As SldWorks.SldWorks

Dim swModel         As modelDoc2

Dim SWAsm           As SldWorks.assemblyDoc

Dim FeatMgr         As SldWorks.FeatureManager

Dim SWFeat2         As SldWorks.feature


Sub main()


Set swApp = CreateObject("SldWorks.Application")

Set swModel = swApp.ActiveDoc

Set SWAsm = swModel


Set FeatMgr = swModel.FeatureManager


Set SWFeat2 = FeatMgr.InsertFeatureTreeFolder2(1)

SWFeat2.Name = "Hi"


'Add subfolder to created folder


End Sub