Access vba: how to hide print dlg during outputTo
Hello,
Does anyone know of a way to hide the printing dialog box that pops up during the outputTo command? I am looping through about 30 reports and saving them as excel files. During this time, the screen flickers with a dialog box stating that the file is being printed to the file location. I would like to avoid that if possible. Here is a code snippet of what I'm currently using:
VB Code:
Do While Not facilitySet.EOF
facility = facilitySet![HOSP NO]
Forms![Intro frm]![Unit No] = facility
DoCmd.OpenReport "Facility Review Report", acViewPreview, , , acHidden
If (Reports.Item(0).HasData <> 0) Then 'if the report has data then save it and email it
filename = "file" & facility & ".xls"
DoCmd.OutputTo acOutputReport, "Facility Review Report", "Microsoft Excel 97-2003", filename, False
EmailModule.sendEmailWithAttachment facilitySet!ContactEmail, from, "", subject, message, filename
End If
'Close the report
DoCmd.Close acReport, "Facility Review Report", acSaveNo
facilitySet.MoveNext
Loop
Thanks,
Ranthalion