attach note leader to part origin

Hi All,

I have created a macro to add notes to a drawing view if certain conditions are met. The only thing is, I can't get the note leader attached to the corresponding part.

The note text values are linked to the part, so somehow the note is connected to the part. Only the leader is randomly placed on the drawing. (should be connected to the bearing (red line))

I use this line to enter the note;

Set swNote = swModelDocExt.InsertBOMBalloon(swBS_Underline, swBF_Tightest, swBalloonTextCustom, "\$PRPMODEL:""PARTNO""\$PRPMODEL:""Cadmes_DOC_NAME""" + Chr(13) + Chr(10) + "\$PRPMODEL:""DESCRIPTION""", swBalloonTextCustom, "", swBF_UserDef, False, 2, "")

I feel like I have to select the origin of the part before adding the note, but I can't get it to work.

Anybody any ideas?

Many thanks in advance,

Willem

SolidworksApi/macros