ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Discussion (Misc queries) (https://www.excelbanter.com/excel-discussion-misc-queries/)
-   -   Print Preview Macro (https://www.excelbanter.com/excel-discussion-misc-queries/91799-print-preview-macro.html)

Emanuel Violante

Print Preview Macro
 
Hi,

The code above is working fine, but it print always to the default printer.

How can i have the available printers, and then select the correct one???

Private Sub Workbook_BeforePrint(Cancel As Boolean)
If ActiveSheet.Name = "CARDEX" Then
Cancel = True
Application.EnableEvents = False
Application.ScreenUpdating = False
With ActiveSheet
On Error Resume Next
.Columns("I").SpecialCells(xlCellTypeBlanks).Entir eRow.Hidden =
True
.Rows("1:6").EntireRow.Hidden = False
.PrintOut
.Columns("I").SpecialCells(xlCellTypeBlanks).Entir eRow.Hidden =
False
On Error GoTo 0
End With
Application.EnableEvents = True
Application.ScreenUpdating = True
End If

--
Thanks,

Emanuel Violante Galeano

paul

Print Preview Macro
 
Application.Dialogs(xlDialogPrint).Show
--
paul

remove nospam for email addy!



"Emanuel Violante" wrote:

Hi,

The code above is working fine, but it print always to the default printer.

How can i have the available printers, and then select the correct one???

Private Sub Workbook_BeforePrint(Cancel As Boolean)
If ActiveSheet.Name = "CARDEX" Then
Cancel = True
Application.EnableEvents = False
Application.ScreenUpdating = False
With ActiveSheet
On Error Resume Next
.Columns("I").SpecialCells(xlCellTypeBlanks).Entir eRow.Hidden =
True
.Rows("1:6").EntireRow.Hidden = False
.PrintOut
.Columns("I").SpecialCells(xlCellTypeBlanks).Entir eRow.Hidden =
False
On Error GoTo 0
End With
Application.EnableEvents = True
Application.ScreenUpdating = True
End If

--
Thanks,

Emanuel Violante Galeano



All times are GMT +1. The time now is 12:16 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com