How to run agent?

please look at the followinge code–>

The code was working fine but now it is showing problem…

Sub Click(Source1 As Button)

Dim ws As New NotesUIWorkspace

Dim Source As NotesUIDocument

Set Source=ws.CurrentDocument

Dim Continue As Variant

Continue=True



Call SAPLeave_Queryclose(Source,Continue)



Dim s As New NotesSession

Dim db As NotesDatabase

Dim agent As NotesAgent

Set db = s.CurrentDatabase



Set agent = db.GetAgent("LeaveCancel") '''' (how to run this agent)



If agent.run= 0 Then	



Else		

End If

End Sub

1)in the above code Call SAPLeave_Queryclose(Source,Continue) is working fine.

2)but the Set agent = db.GetAgent(“LeaveCancel”) is not working , though it is running succesfully it is not giving any result.

i have also copy , paste the coding of leaveCancel and directly put under the button but it is showing error.or you can say not working fine.

Merry Christmas to Everybody.

Subject: How to run agent ?

What is the LeaveCancel agent supposed to do?