Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
How to print a given page in Word
Message
Information générale
Forum:
Visual FoxPro
Catégorie:
COM/DCOM et OLE Automation
Divers
Thread ID:
01226792
Message ID:
01226874
Vues:
20
First keep in mind that VFP needs to follow the command syntax exactly; it does not allow to do it like in VBA Macro where the parameters order is not important. Secondly, syntax for some commands may be extended in the subsequent Word versions.

I gave you the line that works for me in the Word "my" version 2002 SP3, which is:
*-----------------------------------------
*PrintOut method as it applies to the Application, Document, and Window objects.
*Prints all or part of the specified document.

expression.PrintOut(Background, Append, Range, OutputFileName, From, To, Item, Copies, Pages, PageType, PrintToFile, Collate, FileName, ActivePrinterMacGX, ManualDuplexPrint, PrintZoomColumn, PrintZoomRow, PrintZoomPaperWidth, PrintZoomPaperHeight)
*--------------------------------------------------------

Please, review your Word Help, and try to follow its printout() syntax.


Other than that, are you sure that your document contains the proper pagination, does not have sections with their own page numerations, etc?

if you wish, sent your document to me (or any other test document that you cannot print as you wish). I will see whether I can print it correctly.

>I get this code when I record a macro:
Application.PrintOut FileName:="", Range:=wdPrintRangeOfPages, Item:= _
>        wdPrintDocumentContent, Copies:=1, Pages:="3", PageType:=wdPrintAllPages, _
>         ManualDuplexPrint:=False, Collate:=True, Background:=True, PrintToFile:= _
>        False, PrintZoomColumn:=0, PrintZoomRow:=0, PrintZoomPaperWidth:=0, _
>        PrintZoomPaperHeight:=0
>
I tried your code, but it still print out the whole document.
>
>>Did you try to record the MAcro and review its VBA code?
>>Anyway, try:
>>
>>wdPrintRangeOfPages=4
>>?o.ActiveDocument.PrintOut(,,wdPrintRangeOfPages,,,,,,"3")
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform