Hi All,
We use a terminal server session to access and use Microsoft Office.
In Word 2013, we use a macro to initiate a print, which will print 2 copies of a document. One copy will have the 1st page printed on letterhead from a specific tray and the rest from another tray.
The second copy will print from just one tray.
When this macro is ran, it will on occasion crash the terminal server session.
Can anyone see any problems with the below macro code. Many thanks in advance.
Code:
Sub Copy()
'
' Copy Macro
'
'
Selection.WholeStory
' With ActiveDocument.Styles(wdStyleNormal).Font
' If .NameFarEast = .NameAscii Then
' .NameAscii = ""
' End If
' .NameFarEast = ""
' End With
With ActiveDocument.PageSetup
' .LineNumbering.Active = False
' .Orientation = wdOrientPortrait
' .TopMargin = CentimetersToPoints(2.54)
' .BottomMargin = CentimetersToPoints(2.54)
' .LeftMargin = CentimetersToPoints(2.54)
' .RightMargin = CentimetersToPoints(2.54)
' .Gutter = CentimetersToPoints(0)
' .HeaderDistance = CentimetersToPoints(1.25)
' .FooterDistance = CentimetersToPoints(1.25)
' .PageWidth = CentimetersToPoints(21)
' .PageHeight = CentimetersToPoints(29.7)
.FirstPageTray = wdPrinterUpperBin
.OtherPagesTray = wdPrinterLowerBin
' .SectionStart = wdSectionNewPage
' .OddAndEvenPagesHeaderFooter = False
' .DifferentFirstPageHeaderFooter = False
' .VerticalAlignment = wdAlignVerticalTop
' .SuppressEndnotes = False
' .MirrorMargins = False
' .TwoPagesOnOne = False
' .BookFoldPrinting = False
' .BookFoldRevPrinting = False
' .BookFoldPrintingSheets = 1
' .GutterPos = wdGutterPosLeft
End With
Application.PrintOut FileName:="", Range:=wdPrintAllDocument, Item:= _
wdPrintDocumentWithMarkup, Copies:=1, Pages:="", PageType:= _
wdPrintAllPages, Collate:=True, Background:=True, PrintToFile:=False, _
PrintZoomColumn:=0, PrintZoomRow:=0, PrintZoomPaperWidth:=0, _
PrintZoomPaperHeight:=0
Selection.WholeStory
With ActiveDocument.Styles(wdStyleNormal).Font
If .NameFarEast = .NameAscii Then
.NameAscii = ""
End If
.NameFarEast = ""
End With
With ActiveDocument.PageSetup
' .LineNumbering.Active = False
' .Orientation = wdOrientPortrait
' .TopMargin = CentimetersToPoints(2.54)
' .BottomMargin = CentimetersToPoints(2.54)
' .LeftMargin = CentimetersToPoints(2.54)
' .RightMargin = CentimetersToPoints(2.54)
' .Gutter = CentimetersToPoints(0)
' .HeaderDistance = CentimetersToPoints(1.25)
' .FooterDistance = CentimetersToPoints(1.25)
' .PageWidth = CentimetersToPoints(21)
' .PageHeight = CentimetersToPoints(29.7)
.FirstPageTray = 257
.OtherPagesTray = 257
' .SectionStart = wdSectionNewPage
' .OddAndEvenPagesHeaderFooter = False
' .DifferentFirstPageHeaderFooter = False
' .VerticalAlignment = wdAlignVerticalTop
' .SuppressEndnotes = False
' .MirrorMargins = False
' .TwoPagesOnOne = False
' .BookFoldPrinting = False
' .BookFoldRevPrinting = False
' .BookFoldPrintingSheets = 1
' .GutterPos = wdGutterPosLeft
End With
Application.PrintOut FileName:="", Range:=wdPrintAllDocument, Item:= _
wdPrintDocumentWithMarkup, Copies:=1, Pages:="", PageType:= _
wdPrintAllPages, Collate:=True, Background:=True, PrintToFile:=False, _
PrintZoomColumn:=0, PrintZoomRow:=0, PrintZoomPaperWidth:=0, _
PrintZoomPaperHeight:=0
End Sub