BigDaddyO Posted September 10, 2008 Share Posted September 10, 2008 I have a script that I want to print reports using the Excel.au3. I generate the reports fine with the book invisible, Launch the Printer Selection dialog box, Print the report, then close the spreadsheet without saving. Everything is working great, Except... when I do the PrintOut, it displays the excel window momentarialy then hides it. How can I prevent the window from displaying at all. Here is an example of my code. #Include "Excel.au3" $oExcel = _ExcelBookNew(0) _ExcelWriteCell($oExcel, "Sample Section A1", "A1") _ExcelWriteCell($oExcel, "Sample Section A2", "A2") _ExcelWriteCell($oExcel, "Sample Section A5", "A5") _ExcelWriteCell($oExcel, "Sample Section A6", "A6") _ExcelWriteCell($oExcel, "Sample Section B5", "B5") $xlDialogPrinterSetup = 9 $hPrinter = $oExcel.Dialogs($xlDialogPrinterSetup).Show $oExcel.ActiveWorkbook.PrintOut MsgBox(0, "Printed", "") _ExcelBookClose($oExcel, 0, 0) Thanks, Mike Link to comment Share on other sites More sharing options...
BigDaddyO Posted September 10, 2008 Author Share Posted September 10, 2008 Finally figured it out. Apparently because I was showing the Dialog Printer Setup it marked the $oExcel.Visible=1 even though when I created the excel object I set it as not visible. So, imediatly after doing the $xlDialogPrinterSetup).Show I have to then re-set excel to not visible. $xlDialogPrinterSetup = 9 $hPrinter = $oExcel.Dialogs($xlDialogPrinterSetup).Show $oExcel.Visible=0 $oExcel.ActiveWorkbook.PrintOut Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now