• Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint
Share this Page URL
Help

IV. Appendixes > B. Getting the Installed Printers

Appendix B. Getting the Installed Printers

As discussed in Chapter 10, the ActivePrinter property can set the active printer. This raises the issue of how to determine the installed printers on a given computer. Unfortunately, VBA does not seem to provide a way to do this. (Visual Basic has a Printers collection, but Visual Basic for Applications does not.)

In this appendix, we describe a program for getting this printer information. As mentioned in Chapter 10, this program uses the Windows API. To use this program, just type it into your own code, as described here.

The first step is to declare some special constants in the Declarations section of a standard module:

Public Const KEY_ENUMERATE_SUB_KEYS = &H8
Public Const HKEY_LOCAL_MACHINE = &H80000002
Public Const SUCCESS = 0&

PREVIEW

                                                                          

Not a subscriber?

Start A Free Trial


  
  • Creative Edge
  • Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint