Edit/replace reference entities for a point (API)

Hi,

I'm trying to do - what I thought - a simple operation, but the struggle is real... I want to replace a reference in a point, from one spline (Spline1@3DSketch1) to another (Spline1@3DSketch2). I assume that swRefPtData.Selections is an array with reference entities and in my case I just have one entity, therefore I want to replace number 0. Works perfectly when I do it manually, so no issues with the CAD model, but nothing happens when I run the macro (I've re-written the code multiple times, can't figure out what's wrong). My code is based on this example (Ivana's answer): , but instead of changing the distance I want to change the reference entity. Does anyone have an idea?

Here's my code:

Sub main()

Set swApp = _

Application.SldWorks

Set Part = swApp.ActiveDoc

boolstatus = Part.Extension.SelectByID2("Point1", "DATUMPOINT", 0, 0, 0, False, 0, Nothing, 0)

Set swSelMgr = Part.SelectionManager

Set swFeature = swSelMgr.GetSelectedObject6(1, -1)

Set swRefPt = swFeature.GetSpecificFeature2

Set swRefPtData = swFeature.GetDefinition

boolstatus = swRefPtData.AccessSelections(Part, Nothing)

swRefPtData.Selections(0) = "Spline1@3DSketch2"

swFeature.ModifyDefinition swRefPtData, Part, Nothing

Part.EditRebuild3

End Sub

Thanks in advance!

SolidworksApi macros