Hola, que tal.
Te paso información de un parte de un programa que tengo en el cual en un formulario defino que impresora voy a utilizar.
Código:
Private Sub Command1_Click()
If Option1.Value = True Then cImprGen = "\\Servidor\Impresora1"
If Option2.Value = True Then cImprGen = "\\Servidor\Impresora2"
If Option3.Value = True Then cImprGen = "\\Servidor\Impresora3"
For Each xPrint In Printers
If xPrint.DeviceName = cImprGen Then
' La define como predeterminada del sistema.
Set Printer = xPrint
DoEvents
Exit For
End If
Next
Form1.Show
End Sub
Private Sub Form_Load()
List1.Clear
For Each xPrint In Printers
List1.AddItem xPrint.DeviceName
Next
' Defino la Impresora1 como impresora de pruebas determinada
cImprGen = "\\Servidor\Impresora1"
End Sub Y luego cuando quiero imprimir sólo tengo que hacer lo siguiente:
Código:
Printer.FontName = "Courier New"
Printer.FontSize = 9
Printer.CurrentX = 2.2
Printer.CurrentY = 0
Printer.Print Mid(Variable, 2, 42) En el módulo tengo lo siguiente:
Código:
Public cImprGen As String
Public xPrint As Printer
Espero ayudarte.