Const wdPromptToSaveChanges = -2
Const wdSaveChanges = -1
Dim objWord, objDoc, objFS, objFolder, objItem
Set objFS = CreateObject("Scripting.FileSystemObject")
Set objFolder = objFS.GetFolder("c:\work\temp\") 'Папка, из которой производится печать
Set objWord = WScript.CreateObject("Word.Application")
For Each objItem In objFolder.Files
If StrComp(objFS.GetExtensionName(objItem.Name), "doc", vbTextCompare) = 0 Then
With objWord
Set objDoc = .Documents.Open(objItem.Path, False, True, False)
objDoc.PrintOut False
Set objDoc = Nothing
End With
End If
Next
objWord.Quit
Set objWord = Nothing
WScript.Quit 0
|