Ureader.com  
Microsoft software help and Community
   home   |   control panel login   |   archive   |  
 
Word
application.errors
conversions
docmanagement
drawing.graphics
formatting.longdocs
international
internet.assistant
mail
mailmerge.fields
menustoolbars
newusers
numbering
oleinterop
pagelayout
printingfonts
setup.networking
spelling.grammar
tables
vba.addins
vba.beginners
vba.customization
vba.general
vba.userforms
web.authoring
word6-7macros
word97vba
  
 
date: Mon, 22 Sep 2008 15:49:01 -0700,    group: microsoft.public.word.vba.general        back       


Printing Word Doc via Scheduled Task   
Hi 

I am attempting to print a Word document via a vbscript which is triggered 
via a scheduled task on a Windows Terminal Server. The scheduled task is 
configured to run daily.

The process works perfectly when the service account configured to open and 
print the document via the vbscript has an active logon session to the 
Terminal Server.

However when the service account does not have an active logon session, the 
task triggers the script which opens the document and prints, but the 
document remains open thus meaning any additional attempts to open the 
document will advise that the document is locked and the process will fail. 
This also means that the document cannot be edited.

The script is as follows:

set WshShell = WScript.CreateObject("WScript.Shell")
Set objWord = CreateObject("Word.Application")
Set objDoc = objWord.Documents.Open("path to docmuent")

objDoc.PrintOut()
WScript.Sleep 2500
objWord.Quit
WScript.Sleep 2500
WshShell.SendKeys "n" 

Any advice regarding a solution to this problem or an alternative solution 
would be greatly appreciated.
date: Mon, 22 Sep 2008 15:49:01 -0700   author:   David

Google
 
Web ureader.com


    COPYRIGHT 2007, YARDI TECHNOLOGY LIMITED, ALL RIGHT RESERVE  |   contact us