Add mate in an assembly

Hi, It's a bit tricky thing, what i want to do...

I am creating an automation project where I have an assembly. In which 2 parts are there.

Part1 consist of number of holes in plate and Part2 is a tube.

Now every time when automation run, user has to select a hole in which the tube will mate concentrically. I have written the code with the help of message box for asking the user to select a hole. then through code i am selecting the 2nd face of tube. now code will mate them. but i dont know no matter what i have done. it gives error. plz give me any suggestion.

Code:

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

            swmodeldoc = swapp.ActiveDoc

            boolstatus = swmodeldoc.AddComponent(steeltubeloc, -0.2125841970861, -0.1781169141771, -0.1575348078226)

            MsgBox("Select the Hole face through which tube will go.")     'USER WILL SELECT A HOLE'S FACE AND THEN CLICK OK.

            swmodeldoc = swapp.ActiveDoc

            boolstatus = swmodeldoc.Extension.SelectByID2(tubefacename, "AXIS", 0, 0, 0, True, 0, Nothing, 0)     'Selection of tube's axis

            myMate = swmodeldoc.AddMate3(1, 1, False, 0, 0, 0, 0, 0, 0, 0, 0, False, longstatus)

Regards

Devi Prasad Samal

SolidworksApi macros