How to cancel printing?

ljubo_gr

Active Member
Joined
Dec 6, 2014
Messages
251
Office Version
  1. 2013
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

Return population for a City
If you have a list of cities in A2:A100, use Data, Geography. Then =A2.Population and copy down.
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

Forum statistics

Threads
1,223,248
Messages
6,171,027
Members
452,374
Latest member
keccles

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