Example B Calling the Get InstalledPrinters Procedure

Sub DisplayInstalledPrinters() Dim sPrinters() As String Dim cPrinters As Long Dim i As Integer Dim msg As String

' Get the installed printers

GetInstalledPrinters sPrinters(), cPrinters

' Create the message and display it msg = ""

For i = 1 To cPrinters msg = msg & sPrinters(i) & vbCrLf Next i

MsgBox msg, , cPrinters & " Printers" End Sub

The output of this macro on my system is shown in Figure B-1.

0 0

Post a comment