I have a VBS that looks at a set of files and prints them to PDF. The issue I am running into now is that it does not print the entire workbook. If there a string I can add to this code below?
Set fso = CreateObject("Scripting.FileSystemObject")
currentdir = fso.GetAbsolutePathName(".")
Set xmldom = CreateObject("MSXML.DOMDocument")
xmldom.Load(currentdir & "\info.xml")
progid = xmldom.SelectSingleNode("/xml/progid").text
set obj = CreateObject(progid)
printername = obj.GetPrinterName
runonce = obj.GetSettingsFileName(true)
Set fldr = fso.GetFolder(currentdir & "\in")
cnt = 0
For Each f In fldr.files
cnt = cnt + 1
output = currentdir & "\out\" & Replace(f.name, ".xls", "") & ".pdf"
obj.Init
obj.SetValue "Output", output
obj.SetValue "ShowSettings", "never"
obj.SetValue "ShowPDF", "no"
obj.SetValue "ShowProgress", "no"
obj.SetValue "ShowProgressFinished", "no"
obj.SetValue "SuppressErrors", "yes"
obj.SetValue "ConfirmOverwrite", "no"
obj.WriteSettings True
printfile = currentdir & "\in\" & f.name
cmd = """" & currentdir & "\printto.exe"" """ & printfile & """ """ & printername & """"
Set WshShell = WScript.CreateObject("WScript.Shell")
ret = WshShell.Run(cmd, 1, true)
While fso.fileexists(runonce)
wscript.sleep 100
Wend
Next
set obj = Nothing
Wscript.Echo cnt & " documents were printed."