1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38
| Sub VaziImprimeLe(lekel As String, leouerre)
' Force l'impression sur une imprimante connue 1 ex.
' lekel nom de l'état
' leouerre Clause Where
Dim NumIMP As Integer
Dim NombreImp As Integer
Dim ImpCherche
Dim cpt As Integer
NumIMP = 0
NombreImp = Application.Printers.Count
For Each ImpCherche In Application.Printers
If ImpCherche.DeviceName = "TonImprimante" Then
Set Application.Printer = Application.Printers(NumIMP)
Exit For
Else
NumIMP = NumIMP + 1
End If
Next ImpCherche
If NumIMP = NombreImp Then
MsgBox "Vous n'avez pas d'imprimante TonImprimante!!", vbCritical, "Impossible !"
Exit Sub
End If
If leouerre <> "Aucune" Then
DoCmd.OpenReport lekel, acViewPreview, , leouerre ' ICI Etat avec Clause Where
Else
DoCmd.OpenReport lekel, acViewPreview
End If
DoCmd.PrintOut acPrintAll, , , 1
DoCmd.Close acReport, lekel
Set Application.Printer = Nothing
End Sub |
Partager