LastRASErrorCode Example

 

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

 

The example attempts to dial the connection named 溺yConnection. 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 (溺yConnection)

 

 If iSuccess > 0 Then

  MsgBox 鼎onnection successful with RAS handle + AutoMate2.RASHandle + . Click Ok to disconnect.

  AutoMate2.RASDisconnectEx (溺yConnection)

 Else

  MsgBox 鼎onnection failed with code + AutoMate2.LastRASErrorCode + and message: + AutoMate2.LastRASErrorText

 End If

End Sub