View Single Post
 
Old 10-04-2018, 06:43 PM
Guessed's Avatar
Guessed Guessed is offline Windows 10 Office 2016
Expert
 
Join Date: Mar 2010
Location: Canberra/Melbourne Australia
Posts: 4,158
Guessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant future
Default

Using Select Case allows you to be much more succinct with your code by grouping values. There is no value in the goto statement since the code would go there next anyway
Code:
Sub PrintLetterhead()
Dim defprinter As String

defprinter = UCase(Mid(ActivePrinter, 1, 20))
Select Case defprinter
    Case "\\GS-DC2\MFP1", "\\GS-DC2\MFP2", "\\GS-DC2\MFP3", "\\GS-DC2\MFP4", "BOOKKEEPING XEROX WORKCENTRE PRO 5335"
      With ActiveDocument.PageSetup
        .FirstPageTray = 260
        .OtherPagesTray = 259
      End With
    Case "\\GS-DC2\MFP5", "\\GS-DC2\MFP6"
      With ActiveDocument.PageSetup
        .FirstPageTray = wdPrinterMiddleBin
        .OtherPagesTray = wdPrinterLowerBin
      End With
    Case Else
      With ActiveDocument.PageSetup
        .FirstPageTray = 258
        .OtherPagesTray = 259
      End With
End Select
__________________
Andrew Lockton
Chrysalis Design, Melbourne Australia
Reply With Quote