Good Morning All,
quick question! My system default printer is a Lexmark Black & White (Lexmark BW). I want to print out a report in color and have the following code that I use for another routine for Adobe which works fine. But using it for this routine, it still defaults to the BW printer. Can anyone help?
Thanks in advance for your time!
strDefaultPrinter = Application.Printer.DeviceName
Select Case stUserId
Case "Employee #1"
Set Application.Printer = Application.Printers("Lexmark Color")
Case "Employee #2"
Set Application.Printer = Application.Printers("Adobe PDF To Reporting")
End Select
The following is the remainder of the code for sub-routine
'*** Check if this directory and file exist, and if not then notify the user and move to the next report
Set fs = New Scripting.FileSystemObject
If Not (fs.FileExists(sFullPath & sFileName)) Then
MsgBox "The file " & sFileName & " does not exist in " & vbCrLf & _
" folder: " & sFullPath & vbCrLf & _
"Proceeding with the next report selected."
blnPrinted = False
GoTo Print_PowerPoint_Exit
Else
Set pptApp = New PowerPoint.Application
pptApp.Activate
Set pptPres = pptApp.Presentations.Open(sFullPath & sFileName)
pptApp.ActiveWindow.ViewType = ppViewSlide
iSlideCount = pptPres.Slides.Count
pptApp.ActivePresentation.PrintOut From:=1, To:=iSlideCount, Copies:=1, Collate:=msoFalse
For iwait = 1 To 10000
DoEvents
Next iwait
pptPres.Close
Set pptPres = Nothing
pptApp.Quit
Set pptApp = Nothing
MsgBox ("Powerpoint: " & sFileName & " has printed.")
blnPrinted = True
End If
Set Application.Printer = Application.Printers(strDefaultPrinter)
Print_PowerPoint_Exit:
Print_PowerPoint = blnPrinted
End Function
quick question! My system default printer is a Lexmark Black & White (Lexmark BW). I want to print out a report in color and have the following code that I use for another routine for Adobe which works fine. But using it for this routine, it still defaults to the BW printer. Can anyone help?
Thanks in advance for your time!
strDefaultPrinter = Application.Printer.DeviceName
Select Case stUserId
Case "Employee #1"
Set Application.Printer = Application.Printers("Lexmark Color")
Case "Employee #2"
Set Application.Printer = Application.Printers("Adobe PDF To Reporting")
End Select
The following is the remainder of the code for sub-routine
'*** Check if this directory and file exist, and if not then notify the user and move to the next report
Set fs = New Scripting.FileSystemObject
If Not (fs.FileExists(sFullPath & sFileName)) Then
MsgBox "The file " & sFileName & " does not exist in " & vbCrLf & _
" folder: " & sFullPath & vbCrLf & _
"Proceeding with the next report selected."
blnPrinted = False
GoTo Print_PowerPoint_Exit
Else
Set pptApp = New PowerPoint.Application
pptApp.Activate
Set pptPres = pptApp.Presentations.Open(sFullPath & sFileName)
pptApp.ActiveWindow.ViewType = ppViewSlide
iSlideCount = pptPres.Slides.Count
pptApp.ActivePresentation.PrintOut From:=1, To:=iSlideCount, Copies:=1, Collate:=msoFalse
For iwait = 1 To 10000
DoEvents
Next iwait
pptPres.Close
Set pptPres = Nothing
pptApp.Quit
Set pptApp = Nothing
MsgBox ("Powerpoint: " & sFileName & " has printed.")
blnPrinted = True
End If
Set Application.Printer = Application.Printers(strDefaultPrinter)
Print_PowerPoint_Exit:
Print_PowerPoint = blnPrinted
End Function