(view source code of printdoc.vbs as plain text)
Option Explicit
Dim intRC, objWord, strDocFile
With WScript.Arguments
If .Unnamed.Count = 1 Then
strDocFile = WScript.Arguments.Unnamed(0)
Else
Syntax
End If
If .Named.Count > 0 Then Syntax
End With
Set objWord = CreateObject( "Word.Application" )
intRC = objWord.Documents.Open( strDocFile )
objWord.Visible = False
objWord.ScreenUpdating = False
objWord.ActiveDocument.PrintOut False
objWord.ActiveDocument.Close 0
objWord.Quit
Set objWord = Nothing
Sub Syntax
Dim strMsg
strMsg = "PrintDoc.vbs, Version 1.00" _
& vbCrLf _
& "Print a specified MS Word document on the default printer" _
& vbCrLf & vbCrLf _
& "Usage: PRINTDOC.VBS word_document" _
& vbCrLf & vbCrLf _
& "Note: This script requires MS Word to print the document." _
& vbCrLf & vbCrLf _
& "Based on a script by Arnout van der Vorst" _
& vbCrLf _
& "arnoutvandervorst.blogspot.com/2008/03/vbscript-to-automatically-insert.html" _
& vbCrLf & vbCrLf _
& "Written by Rob van der Woude" _
& vbCrLf _
& "http://www.robvanderwoude.com"
WScript.Echo strMsg
WScript.Quit 1
End Sub
page last modified: 2024-04-16; loaded in 0.0046 seconds