I am using the following code to intercept the print event in word all works fine until you have more than one document open with the macro in then you get the message twice. Does anyone have any bright ideas how to stop this happening.


Thanks in advance (fingers crossed)


VB Code:
  1. Private Sub App_DocumentBeforePrint(ByVal Doc As Document, Cancel As Boolean)
  2.        
  3.     usrType = "HKEY_CURRENT_USER"
  4.     location = regget(usrType & "\SOFTWARE\M\User Location")
  5.    
  6.     If Len(location) = 0 Then
  7.         location = regget("HKEY_LOCAL_MACHINE\SOFTWARE\M\Station Location")
  8.     End If
  9.  
  10.     If Left(LCase(location), 6) = "london" Then
  11.         msg = "Only print the draft copy?" & vbCrLf & vbCrLf
  12.         msg = msg & "Yes" & vbTab & "- Print only the draft copy." & vbCrLf
  13.         msg = msg & "No" & vbTab & "- Print both copies." & vbCrLf
  14.         msg = msg & "Cancel" & vbTab & "- Print using your word setting."
  15.    
  16.         clicked = MsgBox(msg, vbYesNoCancel)
  17.            
  18.         If clicked = vbYes Or clicked = vbNo Then
  19.             'Cancel the existing print job
  20.             Cancel = True
  21.            
  22.             If clicked = vbNo Then
  23.                 ' Config the tray as needed for client copy
  24.                 Doc.PageSetup.FirstPageTray = wdPrinterLowerBin
  25.                 Doc.PageSetup.OtherPagesTray = wdPrinterUpperBin
  26.        
  27.                 ' Print the client copy
  28.                 Doc.PrintOut Copies:=1
  29.             End If
  30.    
  31.             ' Config the trays as needed for the file copy
  32.             Doc.PageSetup.FirstPageTray = wdPrinterLargeCapacityBin
  33.             Doc.PageSetup.OtherPagesTray = wdPrinterLargeCapacityBin
  34.            
  35.             'Print the file copy
  36.             Doc.PrintOut Copies:=1
  37.         End If
  38.     End If
  39.  
  40. End Sub