Check for a specific feature in the feature tree

I have a macro that gets the bend radius value from the "Sheet-Metal1" feature in a sheet metal part.   I want to make sure that this feature exist.  If it doesnt, I will notify the user to either rename the feature to the standard name or create the feature (sometimes users dont use the sheet metal feature for a flat part with no bends, which we dont want them to do).

My current code is

Sub main()

     Dim swApp                   As SldWorks.SldWorks

 

    Dim swModel                 As SldWorks.ModelDoc2

 

    Dim swSelMgr                As SldWorks.SelectionMgr

    Dim swFeat                  As SldWorks.Feature

    Dim swSheetMetal            As SldWorks.SheetMetalFeatureData

    Dim bRet                    As Boolean

  

    Dim boolfeat                As Boolean

   

    Dim valueBendRadius         As Double

     Set swApp = Application.SldWorks

     Set swModel = swApp.ActiveDoc

     Set swSelMgr = swModel.SelectionManager

     Set swFeat = swModel.FeatureByName("Sheet-Metal1")

     Set swSheetMetal = swFeat.GetDefinition

    valueBendRadius = Format(swSheetMetal.BendRadius * 39.37007, "#.###")

    swModel.DeleteCustomInfo "Bend_Radius"

    swModel.AddCustomInfo3 "", "Bend_Radius", swCustomInfoType_e.swCustomInfoText, valueBendRadius

End Sub

SolidworksApi macros