Sign in to follow this  
Followers 0
ari

How to print doc w/ PrintOut plus page range?

6 posts in this topic

Hello,

I have a project: print MS word jobs with different page range (not the whole job).

Right now, in AutoIt, I use:

Dim $WordDoc = $WordObj.Documents.Open($file)

$WordDoc.PrintOut

This will print all pages.

Don't know if AutoIt can do like VB does:

Activedocument.Activewindow.PrintOut _

Range:=wdPrintFromTo, From:="1", To:="3"

Or any other ideas? Please help.

Thanks!

Share this post


Link to post
Share on other sites



Yes AutoIt can use that COM method syntax, the parameter strings just have to be quoted properly and enclosed in parens. Something like:

$WordDoc.PrintOut('Range:=wdPrintFromTo, From:="1", To:="3"')

;)


Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law

Share this post


Link to post
Share on other sites

Thank you for the info.

I tried it on AutoIt v3, it's failed.

Any other ideas?

Share this post


Link to post
Share on other sites

#4 ·  Posted (edited)

Well, you probably need the actual value of wdPrintFromTo instead of the string variable name:

Global Const $wdPrintAllDocument = 0
Global Const $wdPrintSelection = 1
Global Const $wdPrintCurrentPage = 2
Global Const $wdPrintFromTo = 3
Global Const $wdPrintRangeOfPages = 4

; ... get $WordDoc somehow...

$WordDoc.PrintOut('Range:=' & $wdPrintFromTo & ', From:="1", To:="3"')

Ref: MSDN: PrintOut Method

Ref: MSDN: Word Enumerated Constants

;)

Edited by PsaltyDS

Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law

Share this post


Link to post
Share on other sites

Thanks again!, I'll try it.

Share this post


Link to post
Share on other sites

I have tried.

I can't make PrintOut('') work, instead _WordDocPrint function works well with Ranges.

Thanks

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