Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Automating Word - Print one page not entire document!
I am using VBA in Excel XP with Windows 2000.
I have a program in which the user can click a button and print a page from a Word document. The problem is, the entire document prints. I have tried several different settings, but nothing seems to work. Could someone please examine my code and determine what is wrong? My latest code follows: Dim wrdApp As Word.Application Set wrdApp = CreateObject("Word.Application") wrdApp.Application.Documents.Open _ strSourceFilePath & strSourceFileName, _ False, _ True, _ False, _ "", _ "", _ False wrdApp.Visible = True wrdApp.Activate wrdApp.Application.PrintOut _ Filename:="", _ Range:=wdPrintFromTo, _ From:=2, _ To:=2, _ Item:=wdPrintDocumentContent, _ Copies:=1, _ Pages:="", _ ManualDuplexPrint:=False, _ Collate:=True, _ Background:=True, _ PrintToFile:=False, _ PrintZoomColumn:=0, _ PrintZoomRow:=0, _ PrintZoomPaperWidth:=0, _ PrintZoomPaperHeight:=0 wrdApp.ActiveDocument.Close SaveChanges:=False wrdApp.Quit Set wrdApp = Nothing Thanks in advance. |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
Automating Word - Print one page not entire document!
this is what I recorded: Printing pages 2 to 3
Application.PrintOut FileName:="", Range:=wdPrintRangeOfPages, Item:= _ wdPrintDocumentContent, Copies:=1, Pages:="2-3", PageType:= _ wdPrintAllPages, ManualDuplexPrint:=False, Collate:=True, Background:= _ True, PrintToFile:=False, PrintZoomColumn:=0, PrintZoomRow:=0, _ PrintZoomPaperWidth:=0, PrintZoomPaperHeight:=0 And to only print page 2 Application.PrintOut FileName:="", Range:=wdPrintRangeOfPages, Item:= _ wdPrintDocumentContent, Copies:=1, Pages:="2", PageType:=wdPrintAllPages, _ ManualDuplexPrint:=False, Collate:=True, Background:=True, PrintToFile:= _ False, PrintZoomColumn:=0, PrintZoomRow:=0, PrintZoomPaperWidth:=0, _ PrintZoomPaperHeight:=0 Word 2002. -- Regards, Tom Ogilvy "quartz" wrote in message ... I am using VBA in Excel XP with Windows 2000. I have a program in which the user can click a button and print a page from a Word document. The problem is, the entire document prints. I have tried several different settings, but nothing seems to work. Could someone please examine my code and determine what is wrong? My latest code follows: Dim wrdApp As Word.Application Set wrdApp = CreateObject("Word.Application") wrdApp.Application.Documents.Open _ strSourceFilePath & strSourceFileName, _ False, _ True, _ False, _ "", _ "", _ False wrdApp.Visible = True wrdApp.Activate wrdApp.Application.PrintOut _ Filename:="", _ Range:=wdPrintFromTo, _ From:=2, _ To:=2, _ Item:=wdPrintDocumentContent, _ Copies:=1, _ Pages:="", _ ManualDuplexPrint:=False, _ Collate:=True, _ Background:=True, _ PrintToFile:=False, _ PrintZoomColumn:=0, _ PrintZoomRow:=0, _ PrintZoomPaperWidth:=0, _ PrintZoomPaperHeight:=0 wrdApp.ActiveDocument.Close SaveChanges:=False wrdApp.Quit Set wrdApp = Nothing Thanks in advance. |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
How to delete entire page 2 so document shows as 1 page only | New Users to Excel | |||
PROBLEM:How to squeeze 2 Page sized Chart in Excel 2000 & embed in Word 2000 and print from Word to fit one page ??? | Excel Discussion (Misc queries) | |||
PROBLEM:How to squeeze 2 Page sized Chart in Excel 2000 & embed in Word 2000 and print from Word to fit one page ??? | New Users to Excel | |||
How do you print Exel gridlines on the entire page ? | Excel Discussion (Misc queries) | |||
How do you format a sheet to fill the entire page to print? | Excel Discussion (Misc queries) |