RASDisconnectEx Example

 

This example demonstrates the use of a number of the AMOLEÆs methods and properties: RASConnect, RASDisconnectEx, RASHandle, LastRASErrorCode, and LastRASErrorText.

 

The example attempts to dial the connection named ôMyConnection.ö If the connection succeeds, the script waits for the user to click the Ok button on the message box that appears, then disconnects. If the connection fails, a message box with the error code and error text is displayed.

 

Sub Main

 Dim iSuccess As Integer

 

 iSuccess = AutoMate2.RASConnect (ôMyConnectionö)

 

 If iSuccess > 0 Then

  MsgBox ôConnection successful with RAS handle ô + AutoMate2.RASHandle + ô. Click Ok to disconnect.ö

  AutoMate2.RASDisconnectEx (ôMyConnectionö)

 Else

  MsgBox ôConnection failed with code ô + AutoMate2.LastRASErrorCode + ô and message: ô + AutoMate2.LastRASErrorText

 End If

End Sub