This is the macro I have to work with. It was written a decade ago. (Un)fortunately we are still using Word 2003 so only changes are the entire firm has moved to Windows 7 and the printers have changed. My problem is this: when I change a tray number(s) below, my save is ignored as if I didn't change a thing.
For example, if below, I change the printer tray numbers from 259 to 261 for Jody's printer, nothing happens. I've created a little macro for myself to ensure I have the right tray numbers and I do, but no change happens, why? A lot of the printers shown below don't exist anymore but Jody's does and it has the right address, so....?
Case "\\ServerName\PR_JODY"
With Selection.PageSetup
.FirstPageTray = 259
.OtherPagesTray = 259
End With
Sub PrintFinal()
Selection.HomeKey Unit:=wdStory
ActiveWindow.ActivePane.View.Type = wdPrintView
EachSection:
ActiveWindow.ActivePane.View.SeekView = wdSeekCurrentPageHeader
ActiveWindow.View.ShowFieldCodes = True
Selection.Find.Replacement.ClearFormatting
With Selection.Find
.Text = "grabthisdocument.doc"
.Replacement.Text = "grabthatdocument.doc"
.Forward = True
.Wrap = wdFindContinue
.Format = False
End With
Selection.Find.Execute Replace:=wdReplaceAll
Selection.WholeStory
Selection.Fields.Update
ActiveWindow.ActivePane.View.SeekView = wdSeekCurrentPageFooter
ActiveWindow.View.ShowFieldCodes = False
Selection.Find.ClearFormatting
With Selection.Find
.Text = "www.domainname.com"
.Replacement.Text = ""
.Forward = True
.Wrap = wdFindContinue
.Format = False
.Execute
If .Found = True Then
Selection.Font.Hidden = True
End If
End With
With Selection.PageSetup
.DifferentFirstPageHeaderFooter = False
End With
Selection.Find.ClearFormatting
With Selection.Find
.Text = "www.domainname.com"
.Replacement.Text = ""
.Forward = True
.Wrap = wdFindContinue
.Format = False
.Execute
If .Found = True Then
Selection.Font.Hidden = True
End If
End With
ActiveWindow.View.ShowFieldCodes = True
ActiveWindow.ActivePane.View.SeekView = wdSeekCurrentPageHeader
Selection.Find.ClearFormatting
Selection.Find.Replacement.ClearFormatting
With Selection.Find
.Text = "Page2grabthisdocument.doc"
.Replacement.Text = "Page2grabthatdocument.doc"
.Format = False
.Forward = True
.Wrap = wdFindContinue
End With
Selection.Find.Execute Replace:=wdReplaceAll
Selection.WholeStory
Selection.Fields.Update
With Selection.PageSetup
.DifferentFirstPageHeaderFooter = True
End With
ActiveWindow.ActivePane.View.SeekView = wdSeekMainDocument
'Selection.Borders(wdBorderTop).LineStyle = wdLineStyleNone
' With Selection.Borders(wdBorderTop)
' .LineStyle = Options.DefaultBorderLineStyle
' .LineWidth = Options.DefaultBorderLineWidth
' .Color = Options.DefaultBorderColor
' End With
'Tray 1 and 2 - Letterhead and 2nd Sheet
Select Case Left(ActivePrinter, 11)
Case "PrinterNameLocationandName"
With Selection.PageSetup
.FirstPageTray = 258
.OtherPagesTray = 259
End With
Case "PrinterNameLocationandName1"
With Selection.PageSetup
.FirstPageTray = 258
.OtherPagesTray = 259
End With
Case "\\XP130\HP5"
With Selection.PageSetup
.FirstPageTray = wdPrinterManualFeed
.OtherPagesTray = wdPrinterLowerBin
End With
Case "PrinterNameLocationandName2"
With Selection.PageSetup
.FirstPageTray = 257
.OtherPagesTray = 257
End With
GoTo continue
Case "PrinterNameLocationandName3"
With Selection.PageSetup
.FirstPageTray = wdPrinterManualFeed
.OtherPagesTray = wdPrinterManualFeed
End With
Case "\\XP105\HPL"
With Selection.PageSetup
.FirstPageTray = wdPrinterManualFeed
.OtherPagesTray = wdPrinterManualFeed
End With
Case "PrinterNameLocationandName4"
With Selection.PageSetup
.FirstPageTray = wdPrinterManualFeed
.OtherPagesTray = wdPrinterManualFeed
End With
Case "\\XP30\HP23"
With Selection.PageSetup
.FirstPageTray = wdPrinterManualFeed
.OtherPagesTray = wdPrinterManualFeed
End With
Case "PrinterNameLocationandName5"
With Selection.PageSetup
.FirstPageTray = wdPrinterManualFeed
.OtherPagesTray = wdPrinterManualFeed
End With
Case "PrinterNameLocationandName6"
With Selection.PageSetup
.FirstPageTray = wdPrinterManualFeed
.OtherPagesTray = wdPrinterManualFeed
End With
Case "PrinterNameLocationandName7"
With Selection.PageSetup
.FirstPageTray = wdPrinterManualFeed
.OtherPagesTray = wdPrinterManualFeed
End With
Case "PrinterNameLocationandName8"
With Selection.PageSetup
.FirstPageTray = wdPrinterManualFeed
.OtherPagesTray = wdPrinterManualFeed
End With
Case "PrinterNameLocationandName9"
With Selection.PageSetup
.FirstPageTray = wdPrinterManualFeed
.OtherPagesTray = wdPrinterManualFeed
End With
Case "PrinterNameLocationandName10"
With Selection.PageSetup
.FirstPageTray = wdPrinterManualFeed
.OtherPagesTray = wdPrinterManualFeed
End With
Case "PrinterNameLocationandName11"
With Selection.PageSetup
.FirstPageTray = wdPrinterManualFeed
.OtherPagesTray = wdPrinterManualFeed
End With
Case "PrinterNameLocationandName12"
With Selection.PageSetup
.FirstPageTray = wdPrinterManualFeed
.OtherPagesTray = wdPrinterManualFeed
End With
Case "PrinterNameLocationandName13"
With Selection.PageSetup
.FirstPageTray = wdPrinterManualFeed
.OtherPagesTray = wdPrinterLowerBin
End With
Case "PrinterNameLocationandName14"
With Selection.PageSetup
.FirstPageTray = 261
.OtherPagesTray = 260
End With
Case "PrinterNameLocationandName15"
With Selection.PageSetup
.FirstPageTray = 261
.OtherPagesTray = 260
End With
Case "PrinterNameLocationandName16"
With Selection.PageSetup
.FirstPageTray = 261
.OtherPagesTray = 260
End With
Case "PrinterNameLocationandName17"
With Selection.PageSetup
.FirstPageTray = 261
.OtherPagesTray = 260
End With
Case "PrinterNameLocationandName18"
With Selection.PageSetup
.FirstPageTray = 258
.OtherPagesTray = 259
End With
Case "PrinterNameLocationandName19"
With Selection.PageSetup
.FirstPageTray = 261
.OtherPagesTray = 260
End With
Case "\PrinterNameLocationandName20"
With Selection.PageSetup
.FirstPageTray = 258
.OtherPagesTray = 259
End With
Case "PrinterNameLocationandName21"
With Selection.PageSetup
.FirstPageTray = 258
.OtherPagesTray = 260
End With
Case "PrinterNameLocationandName22"
With Selection.PageSetup
.FirstPageTray = 259
.OtherPagesTray = 260
End With
Case "PrinterNameLocationandName23"
With Selection.PageSetup
.FirstPageTray = wdPrinterManualFeed
.OtherPagesTray = wdPrinterLowerBin
End With
Case Else
End Select
Select Case UCase(Left(ActivePrinter, 17))
Case "PrinterNameLocationandName24"
With Selection.PageSetup
.FirstPageTray = 261
.OtherPagesTray = 260
End With
Case "PrinterNameLocationandName25"
With Selection.PageSetup
.FirstPageTray = 261
.OtherPagesTray = 260
End With
Case "PrinterNameLocationandName26"
With Selection.PageSetup
.FirstPageTray = 261
.OtherPagesTray = 260
End With
Case "PrinterNameLocationandName27"
With Selection.PageSetup
.FirstPageTray = 261
.OtherPagesTray = 260
End With
Case "PrinterNameLocationandName28"
With Selection.PageSetup
.FirstPageTray = 261
.OtherPagesTray = 260
End With
Case "PrinterNameLocationandName29"
With Selection.PageSetup
.FirstPageTray = 261
.OtherPagesTray = 260
End With
Case "PrinterNameLocationandName30"
With Selection.PageSetup
.FirstPageTray = 261
.OtherPagesTray = 260
End With
Case "PrinterNameLocationandName31"
With Selection.PageSetup
.FirstPageTray = 259
.OtherPagesTray = 259
End With
Case "PrinterNameLocationandName32"
With Selection.PageSetup
.FirstPageTray = 259
.OtherPagesTray = 259
End With
Case Else
With Selection.PageSetup
.FirstPageTray = 261
.OtherPagesTray = 260
End With
End Select
continue:
ActiveWindow.View.ShowFieldCodes = False
With ActiveDocument.Styles("Header").ParagraphFormat
.SpaceAfter = 0
End With
Selection.Find.ClearFormatting
With Selection.Find
.Text = "^b"
.Replacement.Text = ""
.Forward = True
.Wrap = wdFindStop
.Format = False
.MatchCase = False
.MatchWholeWord = False
.MatchWildcards = False
.MatchSoundsLike = False
.MatchAllWordForms = False
.Execute
If .Found = True Then
Selection.MoveRight Unit:=wdCharacter, Count:=1
GoTo EachSection
End If
End With
Dialogs(wdDialogFilePrint).Show
End Sub