Microsoft Office Tutorials and References
In Depth Information
Table 18-2. Members That Return Objects
This method pastes the contents of the Clipboard onto the worksheet, using a specified
format. The most commonly used syntax is simply:
WorksheetObject .PasteSpecial( Format )
where Format specifies the format of the data to paste, as a string. For instance, the
following code pastes data in Word document format (assuming that it exists on the
Clipboard):
ActiveSheet.PasteSpecial "Microsoft Word Document"
To learn the syntax of other Format strings, you can copy the desired object and then
check Excel's Paste Special dialog box.
Note that we must select the destination range before using the PasteSpecial method.
PrintOut method
The PrintOut method prints a worksheet. (The method also applies to Workbook and
Range objects.) The syntax is:
WorksheetObject .PrintOut( From , To, Copies , _
Preview , ActivePrinter , PrintToFile , Collate )
Note that all of the parameters to this method are optional.
The From parameter specifies the page number of the first page to print, and the To
parameter specifies the last page to print. If omitted, the entire object (range, worksheet,
etc.) is printed.
The Copies parameter specifies the number of copies to print. The default is 1 .
Set Preview to True to invoke print preview rather than printing immediately. The
default is False .
ActivePrinter sets the name of the active printer.
Setting PrintToFile to True causes Excel to print to a file. Excel will prompt the user
for the name of the output file. (Unfortunately, there is no way to specify the name of the
output file in code.)
The Collate parameter should be set to True to collate multiple multipage copies.
PrintPreview method
This method invokes Excel's print preview feature for the worksheet. Its syntax is:
WorksheetObject .PrintPreview
Protect method
This method protects a worksheet from modification. Its syntax is:
WorksheetObject .Protect( Password , DrawingObjects , _
Search JabSto ::




Custom Search