LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How can I print a Word document using ActiveX

Solved!
Go to solution

How can I print a Word document using ActiveX?

I can get a document to open and close. Can't find a way to make it print. I think I looked through and tried all the possible properties and methods, however I may have missed the one I need.

I would prefer not opening the document if that is possible.

Please point me in to the right property. Example?

 

Thanks,

Chris

 

0 Kudos
Message 1 of 31
(5,487 Views)

Thanks but I was looking for something a little less canned that I could modify to print specific pages from the file.

Can you help with that?

 

Thanks much.

Chris

 

0 Kudos
Message 3 of 31
(5,484 Views)

hi chris,

 

try this. I have not connected all required inputs , but I guess it could be a start point for you.

Gaurav k
CLD Certified !!!!!
Do not forget to Mark solution and to give Kudo if problem is solved.
0 Kudos
Message 4 of 31
(5,462 Views)

Thank you for your help.

I'm Almost there. I can now print, however I cannot select the desired pages from my document. The entire document prints out.

Neither the Pages input, nor the From/To inputs affect which pages are printed.

I can select the number of copies.

 

See the attached vi.

 

Can you point me in the right direction?

 

Thanks again.

Chris

0 Kudos
Message 5 of 31
(5,442 Views)

It looks like you need to set the right input into the range parameter to use the from/to inputs. 

 

The Range parameter accepts five valid values. Therefore, unless the Range parameter is correctly set, Word will not print. The valid Range values are listed below with a description of the their action:
0 Prints the entire document
1 Prints the selection
2 Prints the current page
3 Prints the range of pages specified by the From and To parameters
4 Prints the range of pages specified by Pages parameter

 

My guess is that LabVIEW defaults to 0 if you don't set the rang. I found this at the following link: http://support.microsoft.com/kb/176069

Applications Engineer
National Instruments
CLD Certified
Message 6 of 31
(5,424 Views)

Thanks Zach for the additional information.

The problem is not yet solved.

0 - prints the entire document

1 - prints a blank page

2 - prints page 1

3 - nothing prints, I have the From To parameters entered.

4 - nothing prints.  I have the Range parameter entered.

 

I'm using Word 2010. maybe there has been a change and this stuff no longer works?? Hope not.

My .vi is attached.

 

Anyone have a solution for this?

 

Thanks,

Chris

 

0 Kudos
Message 7 of 31
(5,401 Views)

@CDreike1 wrote:

Thanks Zach for the additional information.

The problem is not yet solved.

0 - prints the entire document

1 - prints a blank page

2 - prints page 1

3 - nothing prints, I have the From To parameters entered.

4 - nothing prints.  I have the Range parameter entered.

 

I'm using Word 2010. maybe there has been a change and this stuff no longer works?? Hope not.

My .vi is attached.

 

Anyone have a solution for this?

 

Thanks,

Chris

 


When in doubt, always read the Microsoft documentation because that is what you need to understand to get the ActiveX working.

 

http://msdn.microsoft.com/en-us/library/microsoft.office.interop.word.wdprintoutrange.aspx#Y0

0 Kudos
Message 8 of 31
(5,394 Views)

It does look like the page I linked only mentions 95, 97, and 2003. nyc's link looks pretty promising. Were you able to implement any of those functions? 

Applications Engineer
National Instruments
CLD Certified
0 Kudos
Message 9 of 31
(5,374 Views)

Thanks Zach.

 

No I have not yet resolved this problem. I checked on that link from nyc, however that is just too cryptic for me. I'm not a C# programmer, however, it does appear that the functions I need are in Word 2010. Maybe LabView 2010 cannot access the features in Word 2010. Would it change if I moved to LabView 2011? That presents a problem in that I am using some other hardware that has not yet had its drivers updated to 2011. maybe I can induce the supplier to update the drivers.

 

I am getting close to the point where I really need this to work for me.

What more can you do to help?

 

 

Thanks,

Chris Dreike

 

0 Kudos
Message 10 of 31
(5,370 Views)