Net.CancelCon (method)


Net.CancelCon Connection [,[isForce] [,isPermanent]]


The isForce parameter is True if missing or omitted.

The isPermanent parameter indicates if the disconnection should persist to subsequent logon operations.

On all platforms, the Connection parameter specifies what is to be disconnected. If Connection specifies a local device, then only that device is disconnected. If Connection specifies a remote device, then all local devices attached to that remote device are disconnected.

Cancels a network connection.


The Net.CancelCon method takes the following parameters:






String containing the name of the device to cancel, such as "LPT1" or "D:".



Boolean specifying whether to force the cancellation of the connection if there are open files or open print jobs.

If this parameter is True, then this method will close all open files and open print jobs before the connection is closed.

If this parameter is False, this the method will issue a runtime error if there are any open files or open print jobs.


A runtime error will result if no network is present.


This example deletes the drive mapping associated with drive N:.

Sub Main()

  Net.CancelCon "N:"

End Sub

See Also

Net.AddCon (method); Net.GetCon$ (method).

More information