now I can change from default printer (P661), to print certain docs on a different printer (P656) but .... this changes the default printer in windows.
I'm not able to change it back to default printer with vba (did some search)
[vba]
Dim sPrinterOriginal
As String
sPrinterOriginal = Application.ActivePrinter
printing code
'Application.ActivePrinter = sPrinterOriginal
Application.ActivePrinter = Left(sPrinterOriginal, Len(sPrinterOriginal) - 9)
[/vba]Can anyone tell me how to do this with the following macro[vba]Sub PrintNACL_LABEL()
Dim oWord As Object
Dim sPath As String
Dim iCnt As Integer
Dim sPrinterOriginal As String
sPrinterOriginal = Application.ActivePrinter
sPath = ThisWorkbook.Path & Application.PathSeparator & "NACL_LABEL.doc"
iCnt = Val(InputBox("Hoeveel exemplaren?", "NACL_LABEL", 1))
If iCnt >= 1 Then
MsgBox "LABELS WORDEN AFGEDRUKT OP" & vbCr & "KLEURENPRINTER " & _
vbCr & " " & vbCr & "!!! ETIKETTEN NAAR BOVEN LEGGEN !!!", vbExclamation, Title:="AFDRUKKEN MEDICATIELABELTJES"
Set oWord = CreateObject(Class:="Word.Application")
oWord.ActivePrinter = "
\\Plantijn\P656"
With oWord.Documents.Open(sPath)
.PrintOut Background:=False, Copies:=iCnt
.Close False
End With
Application.ActivePrinter = Left(sPrinterOriginal, Len(sPrinterOriginal) - 9)
oWord.Quit False
End If
Set oWord = Nothing
End Sub[/vba]