Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Change Default Printer

Status
Not open for further replies.

Rseven

Technical User
Mar 7, 2006
41
US
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
 
Shouldn't strDefaultPrinter = Application.Printer.DeviceName be after your case statements instead if before it?
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top