#1
|
|||
|
|||
Word 2013 Macro Crashing Terminal Server Session
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 Last edited by macropod; 02-18-2016 at 03:42 PM. Reason: Added code tags & formatting |
#2
|
||||
|
||||
There is nothing in the code that would account for your terminal server session crashing. That said, I can't see the point of having all that commented-out code; it just adds clutter.
PS: When posting code, please use the code tags, indicated by the # button on the posting menu.
__________________
Cheers, Paul Edstein [Fmr MS MVP - Word] |
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Save and restore Word session | Elli | Word | 16 | 10-26-2017 06:29 PM |
Office 2013 is crashing and renaming files when crashing | Brewski | Office | 1 | 09-21-2015 09:04 PM |
Excel 2013 crashing | aki | Excel | 2 | 05-26-2014 01:38 AM |
Outlook 2007 Terminal Server hangs | bpage587 | Outlook | 0 | 10-26-2011 12:08 PM |
Outlook 2003 on Terminal server | Larry Stover | Outlook | 0 | 11-15-2005 09:38 AM |