With object [statements] End With
Parameters
Remarks
The With statement allows you to perform a series of statements on a specified object without requalifying the name of the object. For example, to change a number of different properties on a single object, place the property assignment statements within the With control structure, referring to the object once instead of referring to it with each property assignment. The following example illustrates use of the With statement to assign values to several properties of the same object.
With MyLabel .Height = 2000 .Width = 2000 .Caption = "This is MyLabel" End With
Note Once a With block is entered, object can't be changed. As a result, you can't use a single With statement to affect a number of different objects.
You can nest With statements by placing one With block within another. However, because members of outer With blocks are masked within the inner With blocks, you must provide a fully qualified object reference in an inner With block to any member of an object in an outer With block.
Note In general, it's recommended that you don't jump into or out of With blocks. The object reference for a With block is stored in a temporary variable that has the same lifetime as the procedure. It is set by the With statement, and thus may not be set if you jump into the With block. It is set to Nothing by End With, so jumping out will not free the reference.
Note : Well said, Glenn.
Do...Loop Statement | Using Do...Loop Statements | Using With Statements