How to cancel printing?

ljubo_gr

Board Regular
Joined
Dec 6, 2014
Messages
244
Office Version
  1. 2016
Platform
  1. Windows
Hi,
I have code which display printers available. I need it because, sometimes i print in .pdf, so VBA code cannot detect phisically atached printer. When printer window is shown i cannot cancel or close window, it print whatever i click:(:confused:
Thanks in advance dear excel master!!
Code:
Sub Ispis_Visina()
        On Error GoTo Greh
        Application.ScreenUpdating = False
        Run ([Macro1_SORTIRAJ_VISINE()])
        ThisWorkbook.Worksheets("Visine").Range("i2:L12").Select
        Application.Dialogs(xlDialogPrinterSetup).Show
        Selection.PrintOut Preview:=False
        ThisWorkbook.Worksheets("Visine").Range("A1").Select

Greh:
    Exit Sub
End Sub

 
Last edited:

Excel Facts

Can you AutoAverage in Excel?
There is a drop-down next to the AutoSum symbol. Open the drop-down to choose AVERAGE, COUNT, MAX, or MIN
See if this works for you.
Code:
Sub Ispis_Visina()
        Dim DP As Dialog
        On Error GoTo Greh
        Application.ScreenUpdating = False
        Run ([Macro1_SORTIRAJ_VISINE()])
        Set DP = Application.Dialogs(xlDialogPrinterSetup)
        With DP
            If .Show = -1 Then
                ThisWorkbook.Worksheets("Visine").Range("i2:L12").PrintOut Preview:=False
                ThisWorkbook.Worksheets("Visine").Range("A1").Select
            End If
        End With
Greh:
    Exit Sub
End Sub
 
Last edited:
Upvote 0
Yes, thanks from bottom of my heart!! Sorry for late reply:)
 
Upvote 0

Forum statistics

Threads
1,214,520
Messages
6,120,003
Members
448,935
Latest member
ijat

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top