Microsoft KB Archive/293921

= &quot;Run-time error '9': Subscript out of range&quot; error message when you use Visual Basic for Applications to search for and list available printers in Visio =

Article ID: 293921

Article Last Modified on 10/11/2006

-

APPLIES TO


 * Microsoft Visio 2002 Standard Edition
 * Microsoft Visio 2002 Professional Edition

-



This article was previously published under Q293921





SYMPTOMS
When you use Microsoft Visual Basic for Applications to search for and list available printers, you receive the following error message:

Run-time error '9':

Subscript out of range



CAUSE
No printer is defined on your computer.



RESOLUTION
If a local or network printer is available, you can add a printer to your system configuration. To do this, follow these steps:
 * 1) Click Start, point to Settings, and then click Printers.
 * 2) In the Printers folder, double-click Add Printer, and then follow the instructions in the wizard to install a printer.



STATUS
Microsoft has confirmed that this is a problem in the Microsoft products that are listed at the beginning of this article.



MORE INFORMATION
The following code can be used to search and list the available printers. Application.AvailablePrinters (1) When there is no printer defined on your system, the code returns the error message that is mentioned in the &quot;Symptoms&quot; section of this article, instead of a string to inform you that no printers are defined.

If you omit the subscript altogether Application.AvailablePrinters you receive the following error message:

Compile error:

Expected :=

The following code, which attempts to address the active printer, returns the string &quot;Display&quot; when there is no printer defined: Application.ActivePrinter

Additional query words: VisioDev printer type mismatch expected print display list

Keywords: kbprinters kbtshoot kbbug kberrmsg kbnofix KB293921

-

[mailto:TECHNET@MICROSOFT.COM Send feedback to Microsoft]

© Microsoft Corporation. All rights reserved.