How to change text in a sketch through API

Hi there,

Please forgive my compleet lack of knowledge of solidworks, I'm new to this

For a client I'm looking in to automating part of their production process. For this I need to engrave a serial number in to a part.

I have a part file setup, and a sketch layer containing the default serial number. This is ready to be 'engraved' using the 'Extruded Cut'. All this I can easily script. But... Now the actual text needs to be scripted too... I can't seem to figure out how to do this. If I record a macro of me changing the text, the text does not actually get changed, judging by the code, it just selects the layer:

Set swApp = _

Application.SldWorks

Set Part = swApp.ActiveDoc

Dim myModelView As Object

Set myModelView = Part.ActiveView

myModelView.FrameState = swWindowState_e.swWindowMaximized

boolstatus = Part.Extension.SelectByID2("SketchText1@Sketch1", "EXTSKETCHTEXT", 2.54139940375504E-02, -6.27433895029488E-03, 0, False, 0, Nothing, 0)

Part.ClearSelection2 True

boolstatus = Part.Extension.SelectByID2("SketchText1", "SKETCHTEXT", 2.52552547281462E-02, -6.31707645667292E-03, 0, False, 0, Nothing, 0)

Part.ClearSelection2 True

So... could anybody help me along here.. How do I change the text through API commands?

Thank you so much!!!

SolidworksApi macros