Jump to content
Sign in to follow this  
ari

How to print doc w/ PrintOut plus page range?

Recommended Posts

ari

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
PsaltyDS

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
ari

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
PsaltyDS

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
ari

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  

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.