Microsoft Office Forums

Go Back   Microsoft Office Forums > >

Reply
 
Thread Tools Display Modes
  #1  
Old 02-18-2016, 07:16 AM
exsquaddie exsquaddie is offline Word 2013 Macro Crashing Terminal Server Session Windows 10 Word 2013 Macro Crashing Terminal Server Session Office 2013
Novice
Word 2013 Macro Crashing Terminal Server Session
 
Join Date: Feb 2016
Posts: 1
exsquaddie is on a distinguished road
Default 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
Reply With Quote
  #2  
Old 02-18-2016, 03:44 PM
macropod's Avatar
macropod macropod is offline Word 2013 Macro Crashing Terminal Server Session Windows 7 64bit Word 2013 Macro Crashing Terminal Server Session Office 2010 32bit
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 21,963
macropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond repute
Default

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]
Reply With Quote
Reply



Similar Threads
Thread Thread Starter Forum Replies Last Post
Word 2013 Macro Crashing Terminal Server Session Save and restore Word session Elli Word 16 10-26-2017 06:29 PM
Word 2013 Macro Crashing Terminal Server Session Office 2013 is crashing and renaming files when crashing Brewski Office 1 09-21-2015 09:04 PM
Word 2013 Macro Crashing Terminal Server Session 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

Other Forums: Access Forums

All times are GMT -7. The time now is 09:08 PM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.
Search Engine Optimisation provided by DragonByte SEO (Lite) - vBulletin Mods & Addons Copyright © 2024 DragonByte Technologies Ltd.
MSOfficeForums.com is not affiliated with Microsoft