Hallo,
Wij hebben standaard sjablonen voor brieven en faxen. Nu willen wij dat wanneer men op een specifieke printer print de logo's en dergelijke uit worden gezet. Uit deze printer komt namelijk briefpapier.
Onderstaand script hebben we tot nu toe alleen zet het script in alle situaties de logo's uit. Het maakt niet uit welke printer we selecteren.
Public WithEvents oApp As Word.Application
Private Sub Class_Initialize()
' MsgBox "initialise"
End Sub
Private Sub oApp_DocumentBeforePrint(ByVal Doc As Document, Cancel As Boolean)
Dim StrPrinter As String
On Error GoTo Errorhandler
StrPrinter = Application.ActivePrinter
If Left(StrPrinter, 20) = "Xerox 7655 (Brief)" Or Left(StrPrinter, 8) = "Xerox 55 (Brief)" Then
' Logo's uit zetten
Uit
Else
' Is het een andere printer dan moeten ze aan staan
Aan
End If
Exit Sub
Errorhandler:
Dim Msg As String
Msg = "Fout opgetreden" & Chr(13) & "Foutnummer " & Str(Err.Number) _
& Err.Source & Chr(13) & Err.Description & vbNewLine _
& vbNewLine
MsgBox Msg
End Sub
Private Sub oApp_DocumentOpen(ByVal Doc As Document)
' MsgBox "Doc Open"
End Sub
Private Sub oApp_NewDocument(ByVal Doc As Document)
' MsgBox "New Doc"
End Sub
Wij hebben standaard sjablonen voor brieven en faxen. Nu willen wij dat wanneer men op een specifieke printer print de logo's en dergelijke uit worden gezet. Uit deze printer komt namelijk briefpapier.
Onderstaand script hebben we tot nu toe alleen zet het script in alle situaties de logo's uit. Het maakt niet uit welke printer we selecteren.
Public WithEvents oApp As Word.Application
Private Sub Class_Initialize()
' MsgBox "initialise"
End Sub
Private Sub oApp_DocumentBeforePrint(ByVal Doc As Document, Cancel As Boolean)
Dim StrPrinter As String
On Error GoTo Errorhandler
StrPrinter = Application.ActivePrinter
If Left(StrPrinter, 20) = "Xerox 7655 (Brief)" Or Left(StrPrinter, 8) = "Xerox 55 (Brief)" Then
' Logo's uit zetten
Uit
Else
' Is het een andere printer dan moeten ze aan staan
Aan
End If
Exit Sub
Errorhandler:
Dim Msg As String
Msg = "Fout opgetreden" & Chr(13) & "Foutnummer " & Str(Err.Number) _
& Err.Source & Chr(13) & Err.Description & vbNewLine _
& vbNewLine
MsgBox Msg
End Sub
Private Sub oApp_DocumentOpen(ByVal Doc As Document)
' MsgBox "Doc Open"
End Sub
Private Sub oApp_NewDocument(ByVal Doc As Document)
' MsgBox "New Doc"
End Sub