Batch change structural members, macro help

Hi,

I was wondering if someone can point me in the right direction, I am looking for a macro that will open up parts in a directory, change the structural member to something different save and close all items.

I have had a go but I am very poor at VBA. I have this so far:

Option Explicit

Dim swApp As SldWorks.SldWorks

Dim swModel As SldWorks.ModelDoc2

Dim swModelDocExt As SldWorks.ModelDocExtension

Dim swSelMgr As SldWorks.SelectionMgr

Dim swWeldFeat As SldWorks.Feature

Dim swWeldFeatData As SldWorks.StructuralMemberFeatureData

Dim boolstatus As Boolean

Sub main()

Set swApp = Application.SldWorks

Set swModel = swApp.ActiveDoc

Set swSelMgr = swModel.SelectionManager

Set swModelDocExt = swModel.Extension

boolstatus = swModelDocExt.SelectByID2("Structural Member1", "BODYFEATURE", 0, 0, 0, False, 0, Nothing, 0)

Set swWeldFeat = swSelMgr.GetSelectedObject6(1, 0)

Set swWeldFeatData = swWeldFeat.GetDefinition

swWeldFeatData.AccessSelections swModel, Nothing

swWeldFeatData.WeldmentProfilePath = "C:\Program Files\SolidWorks_2006_sp0\data\weldment profiles\iso\pipe\26.9 x 3.2.sldlfp"

boolstatus = swWeldFeat.ModifyDefinition(swWeldFeatData, swModel, Nothing)

End Sub

SolidworksParts And Features