Copy summary property to custom property

Hello,

I've been trying to figure this out myself for a while now but I'm getting no where fast. I am trying to copy the information contained within the summary properties fields in a model to a specific custom property using a macro. I need to do this as I am trying to update a lot of old models.

I have hashed together code I have found o nthe internet and come up with the following:

-----------------------------------------------------------------

Dim swApp As Object

Sub main()

    Dim swApp             As SldWorks.SldWorks

    Dim swModel          As SldWorks.ModelDoc2

    Dim swCustProp     As CustomPropertyManager

    Dim val                   As String

    Dim valout              As String

    Dim bool                As Boolean

    Dim swSumInfoTitle      As Integer

 

    Set swApp = CreateObject("SldWorks.Application")

    Set swModel = swApp.ActiveDoc

    Set swCustProp = swModel.Extension.CustomPropertyManager("")

 

    valout = instance.SummaryInfo(swSumInfoTitle)

   

    bool = swCustPropMgr.Add("Description", True, val, vaout)

      

    swModel.ForceRebuild3 (False)

    swModel.Save

End Sub

-----------------------------------------------------------------

It doesn't work though. I have been able to get the code to copy in the other direction (From custom property to summary property) using the following code:

-----------------------------------------------------------------

Dim swApp As Object

Sub main()

    Dim swApp             As SldWorks.SldWorks

    Dim swModel          As SldWorks.ModelDoc2

    Dim swCustProp     As CustomPropertyManager

    Dim val                   As String

    Dim valout              As String

    Dim bool                As Boolean

    Set swApp = CreateObject("SldWorks.Application")

    Set swModel = swApp.ActiveDoc

    Set swCustProp = swModel.Extension.CustomPropertyManager("")

      

    bool = swCustProp.Get4("Description", False, val, valout)

    swModel.SummaryInfo(swSumInfoTitle) = valout

  

    swModel.ForceRebuild3 (False)

    swModel.Save

End Sub

-----------------------------------------------------------------

Any help resolving this would be most apriciated!

Thanks

Kevin

SolidworksApi macros