Jump to content

How to print doc w/ PrintOut plus page range?


ari
 Share

Recommended Posts

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!

Link to comment
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
Link to comment
Share on other sites

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
Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...