Jump to content
Sign in to follow this  
ikvergarab

macro para configurar impresora e imprimir

Recommended Posts

buenas noches,

Necesito una macro que me imprima la hoja activa pero debido a que el pc donde va a funcionar la macro tiene varias impresoras asociadas, me gustaría que la macro me escoja una de esas impresoras(que no es la que esta predeterminada) y luego imprima.

gracias!!!! por su valiosA AYUDA!!!

Share this post


Link to post
Share on other sites
Guest sacfa

Espero te sirva:

Sub SeleccionarImpresora()

'Retrieve and set information about the current default printer

Dim FPS As FilePrintSetup

GetCurValues FPS

'Set the default Printer

DefaultPrinter$ = FPS.Printer

FilePrintSetup .Printer = "HP LaserJet IIISi on LPT1:"

'Send the document to the currently selected printer

FilePrint

'Reset to the original default printer

FilePrintSetup .Printer = DefaultPrinter$

End Sub

Comentas si te funciono

- - - - - Mensaje combinado - - - - -

Y adapta esta otra yo lo usaba hace ratos:

Sub SwitchPrinter()

Dim strActivePrinter As String

' Get active printer.

strActivePrinter = Application.ActivePrinter

' Change to the Microsoft Fax printer driver.

Application.ActivePrinter = "Microsoft Fax"

' Print the active document to Fax.

ActiveDocument.PrintOut

' Change back to the default printer.

Application.ActivePrinter = strActivePrinter

End Sub

- - - - - Mensaje combinado - - - - -

Esta macro te permite ver todas las impresoras intaladas, INSERTA UN USERFORM y UN LISTBOX y pega esta macro:

Option Explicit

Private Sub ListBox1_Click()

Dim WshNetwork

Set WshNetwork = CreateObject("WScript.Network")

Dim paso

MsgBox Application.ActivePrinter

paso = ListBox1.Text

WshNetwork.SetDefaultPrinter paso

MsgBox Application.ActivePrinter

End Sub

Private Sub UserForm_Initialize()

Dim WshNetwork, Printers, i

Set WshNetwork = CreateObject("WScript.Network")

Set Printers = WshNetwork.EnumPrinterConnections

For i = 0 To Printers.Count - 1 Step 2

ListBox1.AddItem Printers.Item(i + 1)

Next

End Sub

Share this post


Link to post
Share on other sites
Sign in to follow this  



×
×
  • Create New...

Important Information

Privacy Policy