J SaveAs requires the use of members of the Document objectsuch as Active Document o

Close

Use the Close method to close a specified document or all open documents. By default, a Save dialog appears for any documents with unsaved changes. The SaveChanges argument can be used to change this. To close all open documents without saving changes, use this code:

wdApp.Documents.Close SaveChanges:=wdDoNotSaveChanges

To close a specific document, you can close the active document or you can specify a document name:

wdApp.ActiveDocument.Close or wdApp.Documents("Chapter 17 - Arrays.Doc").Close

Print

Use the Printout method to print part or all of a document. To print a document with all the default print settings:

wdApp.ActiveDocument.PrintOut

By default, the print range is the entire document, but this can be changed by setting the Range and Pages arguments of the Printout method:

wdApp.ActiveDocument.PrintOut Range:=wdPrintRangeOfPages, Pages:="2"

0 0

Post a comment