Microsoft Office Tutorials and References
In Depth Information
Table 18-2. Members That Return Objects
Contents , Scenarios , UserInterfaceOnly )
(Note that the syntax varies from the same method of the Workbook object.)
The optional Password parameter is a string that specifies a case-sensitive password for
The optional DrawingObjects parameter should be set to True to protect shapes. The
default value is False .
The optional Contents parameter should be set to True , the default, to protect the cells
in the worksheet.
The optional Scenarios parameter should be set to True , the default, to protect
The Protect method allows independent protection of cells from changes by the user and
by code. In particular, if UserInterfaceOnly is set to True , then the user cannot
make changes to the worksheet, but changes can be made through code. On the other
hand, if UserInterfaceOnly is False (the default), then neither the user nor the
programmer can alter the worksheet. Note that it is not the macros themselves that are
protected, as the help documentation seems to indicate. Rather, the worksheet is protected
from the effect of the macros.
Note also that if the UserInterfaceOnly argument is set to True when protecting a
worksheet and then the workbook is saved, the entire worksheet (not just the interface)
will be protected when the workbook is reopened. To unprotect the worksheet but
reenable user interface protection, we must reapply the Protect method with
UserInterfaceOnly set to True .
ProtectionMode property (Read-Only)
This property is True if user-interface-only protection is turned on (via the Protect
method). Its default value is False .
This method saves changes to the worksheet in a different file. Its syntax is:
WorksheetObject .SaveAs( Filename , FileFormat , Password , _
WriteResPassword , ReadOnlyRecommended , CreateBackup , _
AddToMru , TextCodePage , TextVisualLayout )
The Filename parameter specifies the filename to use for the newly saved disk file. If a
path is not included, Excel will use the current folder.
The FileFormat parameter specifies the file format to use when saving the file. Its
value is one of the XlFileFormat constants described in our discussion of the
The Password parameter specifies the password to use when saving the file and can be
set to any case-sensitive string of up to 15 characters.