Sign in to follow this  
Followers 0
dpollard

Diagnose Word Printing Problem

4 posts in this topic

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)

Share this post


Link to post
Share on other sites



#2 ·  Posted (edited)

Do you use Office 2010 32 or 64 bit?

Do you compile the script for 32 or 64 bit?

Edited by water

My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2017-04-18 - Version 1.4.8.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (NEW 2017-02-27 - Version 1.3.1.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2015-04-01 - Version 0.4.0.0) - Download - General Help & Support - Example Scripts
Excel - Example Scripts - Wiki
Word - Wiki
PowerPoint (2015-06-06 - Version 0.0.5.0) - Download - General Help & Support

Tutorials:
ADO - Wiki

 

Share this post


Link to post
Share on other sites

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

Share this post


Link to post
Share on other sites

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 bit
  • If you still have problems try with Office 2010 32 bit and compile/run the script for 32 bit
  • Add some COM error checking. This is best done by adding "_WordErrorHandlerRegister()" at the top of your script
Tell us which diagnostic messages you get.

My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2017-04-18 - Version 1.4.8.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (NEW 2017-02-27 - Version 1.3.1.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2015-04-01 - Version 0.4.0.0) - Download - General Help & Support - Example Scripts
Excel - Example Scripts - Wiki
Word - Wiki
PowerPoint (2015-06-06 - Version 0.0.5.0) - Download - General Help & Support

Tutorials:
ADO - Wiki

 

Share this post


Link to post
Share on other sites

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 account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0