03-05-2012 06:56 PM
Hi Zach,
Its not continually throwing errors at all. It just does not print anything using codes 2,3,4. Its as if 0 pages are sent to the printer as the printer queue acknowledges that something was sent.
I only see errors if I use the wrong data format on an input and I've got all that figured out.
I've decided to bite the bullet and reinstall V2011 and try again.
Will let you know tomorrow how that goes.
Chris
03-05-2012 08:09 PM
Hi Zach,
I installed LV2011 and ran the .vi once again. The results are the same.
I suspect something is different in Word 2010.
Is there anyone at NI who could help out with that?
Is there any other way besides ActiveX to print a Word document?
For selection 1, it is sending a command to print a blank page.
If I send this to file, then there are some print commands in the file.
For selections 3 and 4, it seems to be sending an empty file to the printer. (no commands to print anything) no paper comes out of printer.
I can send the print to file and the file will also be empty.
Chris
03-05-2012 08:13 PM
Attached is the VI I would use.
The important thing with anything ActiveX is to read the Microsoft documentation and example.
From their website, it doesn't appear to be necessary to wire anything to the Pages parameter, but you *must* set Range to 3 and you must set values for From and To.
http://msdn.microsoft.com/en-us/library/ff840681.aspx
03-05-2012 11:25 PM
03-06-2012 07:58 AM
@michael Munroe wrote:
Your VI ran perfectly on my Word 2010 with just one modification. The Range input needs to be an integer and not a string. Most enum type selectors including WdPrintOutRange are integers. The only reason that strings are used for the page inputs is to allow for section specifications (ie. S1 to S3).
Duh! My bad.
03-06-2012 10:15 AM
I would like to thank everyone for their persistance in helping me with this problem, particularly Zach.
The problem now seems to be in Word itself.
By chance this morning I tried to print a single page and pages from Word itself and the print function failed in the same was as it is from my ActiveX print.vi. The system reports that a file has been sent to the print, however it is an empty file. I suspect that there is something in my doc file that is causing this error.
Best regards,
Chris
03-06-2012 10:35 AM - edited 03-06-2012 10:37 AM
In your VIs, you did not close all your references. If you look at the VI I attached previously, you will see that all the references are closed.
The problems you are seeing may be that an existing instance of Microsoft Word is still running.
Check the Task Manager.
03-06-2012 11:16 AM
I got access to a machine with word 2010 and LabVIEW 2011 and was able to print the pages I specified.
I'm wondering if it has something to do with the file you're trying to print. It looks like its a .dot file not a word document.
Have you tried a just using a .docx file?
03-06-2012 04:11 PM
Thanks for all the input.
As for having another instance of Word running, I don't have one. Checked the Task Manager.
Here is the problem:
The document I have to use in this application contains many sections. it was created in Word 2000 or 2003. I've now been told by others here that there is quite a problem in trying to print individual pages once sections have been introduced into a document. The sections are used to separate header and footers so that different headers and footers may be used throughout the document.
I will a create multi section document in Word 2010 and see if that solves the problem. I suspect it may not. There may simply be a bug in Word that causes what I'm seeing.
I will post back in a day or two with the results.
Thanks All !!
Chris
03-06-2012 04:13 PM
One more little tidbit:
When trying to print from within Word itself, I see exactly the same problems.
I can print the entire document or the current page. I cannot selectively print a specific page or page from a section. If I try, an empty file is sent to the printer and not even a blank page is printed.
Regards,
Chris