Microsoft Office Tutorials and References
In Depth Information
17.2.1 Activate Method
Let us look at a few of the more commonly used members from Table 17-1 .
17.2.1 Activate Method
This method activates the workbook. The syntax is straightforward, as in:
Workbooks("MyWorkBook").Activate
Note that Workbooks is global, so we do not need to qualify it with the Application keyword.
17.2.2 Close Method
The Close method closes the workbook. Its syntax is:
WorkbookObject .Close( SaveChanges , FileName , RouteWorkbook )
Note that the Close method of the Workbook object has three parameters, unlike the Close method
of the Workbooks object, which has none.
The optional SaveChanges parameter is used to save changes to the workbook before closing. In
particular, if there are no changes to the workbook, the argument is ignored. It is also ignored if
the workbook appears in other open windows. On the other hand, if there are changes to the
workbook and it does not appear in any other open windows, the argument takes effect.
In this case, if SaveChanges is True , the changes are saved. If there is not yet a filename
associated with the workbook (that is, if it has not been previously saved), then the name given in
FileName is used. If FileName is also omitted, Excel will prompt the user for a filename. If
SaveChanges is False , changes are not saved. Finally, if the SaveChanges argument is
omitted, Excel will display a dialog box asking whether the changes should be saved. In short, this
method behaves as you would hope.
The optional RouteWorkbook refers to routing issues; we refer the interested reader to the Excel
VBA help file for more information.
It is important to note that the Close method checks the Saved property of the workbook to
determine whether or not to prompt the user to save changes. If we set the Saved property to True ,
then the Close method will simply close the workbook with no warning and without saving any
unsaved changes.
17.2.3 DisplayDrawingObjects Property
This property returns or sets a value indicating how shapes are displayed. It can be one of the
following XlDisplayShapes constants:
Enum XlDisplayShapes
XlDisplayShapes = -4104
xlPlaceholders = 2
xlHide = 3
End Enum
17.2.4 FileFormat Property (Read-Only Long )
This property returns the file format or type of the workbook. It can be one of the following
XlFileFormat constants:
Search JabSto ::




Custom Search