All Statements
All Objects
STATEMENT: With ... End With
With
object
any legal code
End With
Implemented in version 5.0
The
With
statement allows you to execute code on the named object. It is very important to understand that you can only specify a single object to be acted upon. You cannot list several objects.
You can nest
With
statements inside of other
With
statements or inside other conditional statements, such as an
If Else
. However, do not jump into or out of
With ... End With
blocks of code. The problem is that either the
With
or
End With
portion of the statement may not be executed and this could cause errors or generate erroneous results.
Between the object name and
End With
, you may place any legal block of VBScript code. For example, you could place statements assigning values to the properties of the designated object, as shown below.
Code:
<%
With CatObject
Rem assign properties
.CatName = "Amy"
.CatAge = 3
.CatColor = "black, orange, white"
End With
%>
Copyright 1999-2001 by Infinite Software Solutions, Inc. All rights reserved.
Trademark Information