Suppress Fillin field prompt in vbscript

C

Chad Brogan

I've got a vbscript that recursively searches for and prints documents
in a directory to file. When it stumbles across a document with a
fillin field prompt, the vbscript stops until I can hit ok. Is there
a way to suppress this prompt? If not, is there a way to
automatically hit OK when the prompt comes up? Here's the sub I'm
using to accomplish this task.

*********vbscript*********
Sub ConvertOffice(oCurrentFolder, oWord, oExcel, docnumber, xlsnumber,
rtfnumber, txtnumber)

Dim strTemp
Dim docSearch
Dim exlSearch
Dim rtfSearch
Dim txtSearch
Dim strOutput
Dim oNewFolder
Dim oFile
Dim oStream
Dim FileOutdoc
Dim FileOutxls
Dim FileOutrtf
Dim FileOuttxt
Dim oDocument

docSearch = ".doc"
exlSearch = ".xls"
rtfSearch = ".rtf"
txtSearch = ".txt"

For Each oFile In oCurrentFolder.Files
strTemp = Right(oFile.Name, 4)
FileTemp = Cstr(oCurrentFolder) & "\" & Cstr(oFile.Name)
FileTemplcase = LCase(FileTemp)
FileTempcomma = Replace(FileTemplcase,",","")
FileOutdoc = Replace(FileTempcomma,".doc",".ps")
FileOutxls = Replace(FileTempcomma,".xls",".ps")
FileOutrtf = Replace(FileTempcomma,".rtf",".ps")
FileOuttxt = Replace(FileTempcomma,".txt",".ps")

If UCase(strTemp) = UCase(docSearch) Then
Set oDocument = oWord.Documents.Open(oFile.Path, False, True)
oDocument.Fields.locked = True
oWord.PrintOut False, False, , FileOutdoc, , , , , , , True
Do until oWord.BackgroundPrintingStatus = 0
Loop
oWord.Application.ActiveDocument.close False
docnumber = docnumber + 1
ElseIf UCase(strTemp) = UCase(rtfSearch) Then
oWord.Documents.Open oFile.Path, False, True
oWord.PrintOut False, False, , FileOutrtf, , , , , , , True
Do until oWord.BackgroundPrintingStatus = 0
Loop
oWord.Application.ActiveDocument.close False
rtfnumber = docnumber + 1
Elseif UCase(strTemp) = UCase(txtSearch) Then
oWord.Documents.Open oFile.Path, False, True
oWord.PrintOut False, False, , FileOuttxt, , , , , , , True
Do until oWord.BackgroundPrintingStatus = 0
Loop
oWord.Application.ActiveDocument.close False
txtnumber = docnumber + 1
Elseif UCase(strTemp) = UCase(exlSearch) Then
Set oWorkbooks = oExcel.workbooks.open(FileTemp)
oWorkbooks.PrintOut , , , , , True, , FileOutxls
oExcel.workbooks(Cstr(oFile.Name)).close False
xlsnumber = xlsnumber + 1
End If
Next

For Each oNewFolder In oCurrentFolder.subFolders
ConvertOffice oNewFolder, oWord, oExcel, docnumber, xlsnumber,
rtfnumber, txtnumber
Next

End Sub
******end vbscript*******
 
W

Word Heretic

G'day (e-mail address removed) (Chad Brogan),

Ergle. Just guesses, not likely to work, but you could try:

Opening as read only or even visible=false. I don't think
Application.DisplayAlerts will help you here.

Turning off update links at printing.

Queue up some escapes or something useful from SendKeys before
opening.


Steve Hudson - Word Heretic
Want a hyperlinked index? S/W R&D? See WordHeretic.com

steve from wordheretic.com (Email replies require payment)


Chad Brogan reckoned:
 
Top