INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Jobs

Change Default Printer

Change Default Printer

(OP)
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

RE: Change Default Printer

Shouldn't strDefaultPrinter = Application.Printer.DeviceName be after your case statements instead if before it?

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members!

Resources

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close