How to troubleshoot VBA

Hi there,
Is there any guide lines on how to troubleshoot the solidwork API?

I am trying to use the macro-programming to record a set steps to model a CAD model in solidwork.
However, the direction of extrusion/surface etc often go the wrong way.

Is there any reliable background reading? I tried using the API help of solidwork, but the help seems to focus more on giving example rather than trouble shooting.

These are the codes generated for ruled surface:

boolstatus = Part.Extension.SelectByID2("Top Plane", "PLANE", 0, 0, 0, True, 0, Nothing, 0)
boolstatus = Part.Extension.SelectByID2("", "EDGE", 0.135976039502168, -2.97543949024544E-02, -2.66014941007029E-02, True, 0, Nothing, 0)
Part.ClearSelection2 True
boolstatus = Part.Extension.SelectByID2("Split Line1", "BODYFEATURE", 0, 0, 0, False, 0, Nothing, 0)
boolstatus = Part.Extension.SelectByID2("Top Plane", "PLANE", 0, 0, 0, True, 1, Nothing, 0)
boolstatus = Part.Extension.SelectByID2("", "EDGE", 0.135976039502168, -2.97543949024544E-02, -2.66014941007029E-02, True, 4, Nothing, 0)
Set myFeature = Part.FeatureManager.InsertRuledSurfaceFromEdge2(2, 0.002, True, False, True, 1.74532925199433E-02, False, 1, 0, 0, True)

Attached also is the generated CAD. but the ruled surface is in the wrong direction. The desired direction is indicated in red arrow