dpollard Posted June 7, 2012 Posted June 7, 2012 Hi Everyone, I'm trying to print a word document but nothing goes to the print queue and I'm not getting any error messages. I'm using the word.au3 include file and the _WordDocPrint function. I'm stumped as to what I'm doing wrong. It is part of a larger app but I have cut it down to the bare bones in this example to demonstrait the problem. All my message boxes return success (0) or (00) I'm using Office 2010 on Windows 7 64bit. Any assistance greatly appricated. #include <word.au3> Global $DoNotSaveChanges = 0 Global $hWordApplication Global $hWordDocument $hWordApplication = _WordCreate("") MsgBox(0,"Debug","Open Word=" &@error& @extended) $hWordDocument = _WordDocOpen($hWordApplication, @ScriptDir & "\templates\test.docx") MsgBox(0,"Debug","Open Document=" &@error& @extended) ;Print the Document _WordDocPrint($hWordDocument,"HPOfficeJet6500") MsgBox(0,"Debug","Print Document=" &@error & @extended) ;Close the document _WordDocClose($hWordDocument,$DoNotSaveChanges) MsgBox(0,"Debug","Close Document=" &@error& @extended) ;Exit Word _WordQuit($hWordApplication,0) MsgBox(0,"Debug","ExitWord=" & @error @extended)
water Posted June 7, 2012 Posted June 7, 2012 (edited) Do you use Office 2010 32 or 64 bit? Do you compile the script for 32 or 64 bit? Edited June 7, 2012 by water My UDFs and Tutorials: Spoiler UDFs: Active Directory (NEW 2024-07-28 - Version 1.6.3.0) - Download - General Help & Support - Example Scripts - Wiki ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki Task Scheduler (2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki Standard UDFs: Excel - Example Scripts - Wiki Word - Wiki Tutorials: ADO - Wiki WebDriver - Wiki
dpollard Posted June 7, 2012 Author Posted June 7, 2012 Office is 64bit I think. Winword.exe is not in the program files 32 folder. I haven't changed any of the autoit settings so I'm assuming it is compiling in 32 bit. How do I tell if it is compiling in 32 or 64 bit. When I deploy it could be run on either architecture which is why I was hoping to get it to work in std 32 bit. Thanks David
water Posted June 7, 2012 Posted June 7, 2012 Office 64 bit is not recommended (not even by MS) and often causes problems. There was a thread about 32/64 bit Office which I can't find at the moment.What you need to do is:Compile/Run the AutoIt script for 64 bit if your Office is 64 bitIf you still have problems try with Office 2010 32 bit and compile/run the script for 32 bitAdd some COM error checking. This is best done by adding "_WordErrorHandlerRegister()" at the top of your scriptTell us which diagnostic messages you get. My UDFs and Tutorials: Spoiler UDFs: Active Directory (NEW 2024-07-28 - Version 1.6.3.0) - Download - General Help & Support - Example Scripts - Wiki ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki Task Scheduler (2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki Standard UDFs: Excel - Example Scripts - Wiki Word - Wiki Tutorials: ADO - Wiki WebDriver - Wiki
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