HOW TO
This ArcObjects code sample shows how to programmatically change the printer.
Note:
Code in the Project's ThisDocument code module will only run in the current map document. If you want to store the code in all your map documents, open the Normal.mxt ThisDocument code module instead.
Code:
Public Sub ChangePrinter()
Dim pEnumPrinters As IEnumPrinterNames
Dim pMxApp As IMxApplication
Dim pPaper As IPaper
Dim pPrinter As IPrinter
Dim sPrinterName As String
Set pMxApp = Application
Set pPrinter = pMxApp.Printer
Set pPaper = pMxApp.Paper
Set pEnumPrinters = Application
pEnumPrinters.Reset
sPrinterName = pEnumPrinters.Next
Do While Not sPrinterName = ""
Debug.Print sPrinterName
sPrinterName = pEnumPrinters.Next
If sPrinterName = "\\OMNI\Zzyzx" Then
pPaper.PrinterName = sPrinterName
Exit Do
End If
Loop
End Sub
Article ID:000004724
Get help from ArcGIS experts
Download the Esri Support App