# Keyword Reference

# With...EndWith

Used to reduce long references to dot-accessible type of variables.

With <expression>
statements
...
EndWith

## Parameters

expression | Must be an object type expression or a DllStruct type

## Remarks

With...EndWith statements may be nested.
If expression is a DllStruct type, it can be reference as $tStruct.elementName

## Related

For...In...Next

## Example

    Local $oExcel = ObjCreate("Excel.Application")
    $oExcel.visible = 1
    $oExcel.workbooks.add

    With $oExcel.activesheet
        .cells(2, 2).value = 1
        .range("A1:B2").clear
    EndWith

    $oExcel.quit