SetDefaultPrinter, méthode

Définit l'imprimante distante spécifiée comme imprimante par défaut.

object.SetDefaultPrinter strPrinterName

Arguments

object

Objet WshNetwork.

strPrinterName

Nom de l'imprimante distante à définir comme imprimante par défaut, tel que "\\Server\Printer1."

Exemple

L'exemple suivant utilise la méthode AddPrinterConnection pour connecter une imprimante de réseau au port LPT1: puis définit cette imprimante comme imprimante par défaut :

Set WshNetwork = WScript.CreateObject("WScript.Network")
WshNetwork.AddPrinterConnection "LPT1:", "\\Server\Print1"
WshNetwork.SetDefaultPrinter "\\Server\Print1"

Voir aussi

AddPrinterConnection, méthode | AddWindowsPrinterConnection, méthode | EnumPrinterConnections, méthode | RemovePrinterConnection, méthode

Application : WshNetwork, objet