Jump to content

Recommended Posts

Posted

Has anyone come across a small script or program that basically asks "Are you sure you want to print?" before someone prints?

 

I don't want anything like PaperCut or PCounter, I just want something free that displays a pop-up that confirms you want to print before you do so.

 

Any help appreciated :-)

Posted

ok, this will get people to click ok or cancel to the print, and then, ask how many copies they want.

 

Sub Print()
Dim NoCopies As String
Dim DP As String
Dim CP As String
Dim Response As VbMsgBoxResult 
Response = MsgBox("Are you sure you want to print" & vbCrLf & _ 
"Click 'OK' to print. " & vbCrLf & _ 
"Or click 'Cancel' to stop printing.", _ 
vbExclamation + vbOKCancel) 
If Response = vbOK Then 
Application.Dialogs(xlDialogPrinterSetup).Show 
Application.ScreenUpdating = False 
Resume 
Else 
Resume AllDone 
End If 
End With ) 
NoCopies = InputBox(Prompt:="How many copies would you like? Please enter a value from 0 - 5", Title:="Copies?")
DP = ".."       'Define Clients Default Printer
CP = ".."  	'Define Clients New Colour Printer
ActivePrinter = CP 'Change printer to duplex printer
If NoCopies = "0" Or NoCopies = "1" Or NoCopies = "2" Or NoCopies = "3" Or NoCopies = "4" Or NoCopies = "5" Then
With ActiveDocument.PageSetup 
       .FirstPageTray = wdPrinterFormSource
       .OtherPagesTray = wdPrinterFormSource
End With
  Application.PrintOut FileName:="", Range:=wdPrintAllDocument, Item:= _
      wdPrintDocumentContent, Copies:=1, Pages:="", PageType:=wdPrintAllPages, _
      ManualDuplexPrint:=False, Collate:=True, Background:=True, PrintToFile:= _
      False, PrintZoomColumn:=0, PrintZoomRow:=0, PrintZoomPaperWidth:=0, _
      PrintZoomPaperHeight:=0 

With ActiveDocument.PageSetup
       .FirstPageTray = wdPrinterFormSource
       .OtherPagesTray = wdPrinterFormSource
End With
'Print Copy or Copies
   If NoCopies = 1 Then
   Application.PrintOut FileName:="", Range:=wdPrintAllDocument, Item:=wdPrintDocumentContent, Copies:=1, Pages:="", PageType:=wdPrintAllPages, ManualDuplexPrint:=False, Collate:=True, Background:=True, PrintToFile:=False, PrintZoomColumn:=0, PrintZoomRow:=0, PrintZoomPaperWidth:=0, PrintZoomPaperHeight:=0
   ElseIf NoCopies = 2 Then
   Application.PrintOut FileName:="", Range:=wdPrintAllDocument, Item:=wdPrintDocumentContent, Copies:=2, Pages:="", PageType:=wdPrintAllPages, ManualDuplexPrint:=False, Collate:=True, Background:=True, PrintToFile:=False, PrintZoomColumn:=0, PrintZoomRow:=0, PrintZoomPaperWidth:=0, PrintZoomPaperHeight:=0
   ElseIf NoCopies = 3 Then
   Application.PrintOut FileName:="", Range:=wdPrintAllDocument, Item:=wdPrintDocumentContent, Copies:=3, Pages:="", PageType:=wdPrintAllPages, ManualDuplexPrint:=False, Collate:=True, Background:=True, PrintToFile:=False, PrintZoomColumn:=0, PrintZoomRow:=0, PrintZoomPaperWidth:=0, PrintZoomPaperHeight:=0
   ElseIf NoCopies = 4 Then
   Application.PrintOut FileName:="", Range:=wdPrintAllDocument, Item:=wdPrintDocumentContent, Copies:=4, Pages:="", PageType:=wdPrintAllPages, ManualDuplexPrint:=False, Collate:=True, Background:=True, PrintToFile:=False, PrintZoomColumn:=0, PrintZoomRow:=0, PrintZoomPaperWidth:=0, PrintZoomPaperHeight:=0
   ElseIf NoCopies = 5 Then
   Application.PrintOut FileName:="", Range:=wdPrintAllDocument, Item:=wdPrintDocumentContent, Copies:=5, Pages:="", PageType:=wdPrintAllPages, ManualDuplexPrint:=False, Collate:=True, Background:=True, PrintToFile:=False, PrintZoomColumn:=0, PrintZoomRow:=0, PrintZoomPaperWidth:=0, PrintZoomPaperHeight:=0
   ElseIf NoCopies = 0 Then
   End If
With ActiveDocument.PageSetup ' Change tray to AUTO
       .FirstPageTray = wdPrinterFormSource
       .OtherPagesTray = wdPrinterFormSource
End With
Else 'if wrong value is entered
MsgBox ("Please Enter a value from 0-5")
ActivePrinter = DP
NoCopies = ""
Exit Sub
End If
'Change Printer Back
ActivePrinter = DP
NoCopies = ""
End Sub

 

Fully tested on Office 2003 and 2010.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now



×
×
  • Create New...