Article ID: 176069
Article Last Modified on 2/24/2005
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 parameterFor more information about the FilePrint command in Word 95 and PrintOut command in Word 97 or Microsoft Office Word 2003, see the Word for Windows documentation. The format of the Word 97 PrintOut method and the Word 95 FilePrint command are listed below:
PrintOut(Background, Append, Range, OutputFileName, From, To, Item, Copies, Pages, PageType, PrintToFile, Collate, FileName, ActivePrinterMacGX, ManualDuplexPrint) FilePrint(.Background, .AppendPrFile, .Range, .PrToFileName, .From, .To, .Type, .NumCopies, .Pages, .Order, .PrintToFile, .Collate, .FileName, .OutputPrinter)In the code examples below a Word document named Testdoc.doc is used that contains at least 10 pages.
range = "3"
from = "4"
to = "8"
oword = CreateObject("Word.Basic")
WITH oword
.FileOpen("C:\winword\testdoc.doc") && Enter appropriate path.
* FilePrint statement using variables.
*.FilePrint(0,"0","",0,range,"",from,to)
* FilePrint using explicit values
.FilePrint(0,"0","",0,"3","","4","8")
.FileClose(2)
ENDWITH
oword=""
Note This works with Word 97 or Microsoft Office Word 2003 and Visual FoxPro for Windows version 5.0a
with Service Pack 2 or later:
range = "3"
from = "4"
to = "8"
oword = CreateObject("Word.Application")
WITH oword
.Documents.Open("C:\winword\testdoc.doc") && Enter appropriate path.
* PrintOut statement using variables
*.ActiveDocument.PrintOut(0,0,range,"",from,to)
* PrintOut using explicit values
.ActiveDocument.PrintOut(0,0,"3","","4","8")
.Quit
ENDWITH
range = "4"
pages = "4-8"
oword = CreateObject("Word.Basic")
WITH oword
.FileOpen("C:\winword\testdoc.doc") && Enter appropriate path.
* FilePrint statement using variables.
*.FilePrint(0,"0","",0,range,"","","",0,1,pages)
* FilePrint using explicit values
.FilePrint(0,"0","",0,"4","","","",0,1,"4-8")
.FileClose(2)
ENDWITH
oword=""
Note This works with Word 97 or Microsoft Office Word 2003 and Visual FoxPro for Windows version 5.0a
with Service Pack 2 or later:
range = "4"
pages = "4-8"
oword = CreateObject("Word.Application")
WITH oword
.Documents.Open("C:\winword\testdoc.doc") && Enter appropriate path.
* PrintOut statement using variables
*.ActiveDocument.PrintOut(0,0,range,"","","",0,1,pages)
* PrintOut using explicit values
.ActiveDocument.PrintOut(0,0,"4","","6","8",0,1,"4-8")
.Quit
ENDWITH
range = "4"
pages = "2,6-9"
oword = CreateObject("Word.Basic")
WITH oword
.FileOpen("C:\winword\testdoc.doc") && Enter appropriate path.
* FilePrint statement using variables.
*.FilePrint(0,"0","",0,range,"","","",0,1,pages)
* FilePrint using explicit values
.FilePrint(0,"0","",0,"4","","","",0,1,"2,6-9")
.FileClose(2)
ENDWITH
oword=""
Note This works with Word 97 or Microsoft Office Word 2003 and Visual FoxPro for Windows version 5.0a
with Service Pack 2 or later:
range = "4"
pages = "2,6-9"
oword = CreateObject("Word.Application")
WITH oword
.Documents.Open("C:\winword\testdoc.doc") && Enter appropriate path.
* PrintOut statement using variables
*.ActiveDocument.PrintOut(0,0,range,"","","",0,1,pages)
* PrintOut using explicit values
.ActiveDocument.PrintOut(0,0,"4","","","",0,1,"2,6-9")
.Quit
ENDWITH
Keywords: kbhowto kbinterop kbautomation KB176069