Shell.FindPrinter method

Displays the Find Printer dialog box.

Syntax

iRetVal = Shell.FindPrinter(
  [ sName ],
  [ sLocation ],
  [ sModel ]
)

Shell.FindPrinter( _
  [ ByVal sName As BSTR ], _
  [ ByVal sLocation As BSTR ], _
  [ ByVal sModel As BSTR ] _
) As Integer

Parameters

sName [in, optional]

Type: BSTR

A String that contains the printer name.

sLocation [in, optional]

Type: BSTR

A String that contains the printer location.

sModel [in, optional]

Type: BSTR

A String that contains the printer model.

Remarks

If you assign strings to one or more of the optional parameters, they are displayed as default values in the associated edit control when the Find Printer dialog box is displayed. The user can either accept or override these values. If no value is assigned to a parameter, the associated edit box is empty and the user must enter a value.

This method is not currently available in Microsoft Visual Basic.

Examples

The following examples show the use of FindPrinter to display the Find Printer dialog box for a particular application. Usage is shown for JScript, VBScript, and Visual Basic.

JScript:

<script language="JScript">
    function fnFindPrinterJ()
    {
        var objShell = new ActiveXObject("shell.application");
        
        objShell.FindPrinter();
    }
</script>

VBScript:

<script language="VBScript">
    function fnFindPrinterVB()
        dim objShell
        dim bReturn

        set objShell = CreateObject("shell.application")
        objShell.FindPrinter()

        set objShell = nothing
    end function
</script>

Requirements

Requirement Value
Minimum supported client
Windows 2000 Professional, Windows XP [desktop apps only]
Minimum supported server
Windows Server 2003 [desktop apps only]
Header
Shldisp.h
IDL
Shldisp.idl
DLL
Shell32.dll (version 5.0 or later)