Examples: With statement

Class Employee
   Public empName As String
   Public status As Integer
   Sub SetName
      empName$ = InputBox$("Enter name:")
   End Sub
End Class
Dim emp As New Employee
Dim emp2 As New Employee
With emp
   Call .SetName    ' Calls InputBox$ to prompt
                    ' for an employee name to assign
                    ' to emp.empName.
   Set emp = emp2   ' Reassigns the emp object variable,
                    ' to refer to a different object 
                    ' (the same object that emp2 refers to).
   .status% = 1     ' Sets status of the object that emp
                    ' referred to when the With statement
                    ' was entered.
   emp.status% = 0  ' Sets both emp.status and emp2.status,
                    ' because of the preceding Set statement.
   Print .status% ; emp.status% ; emp2.status%   
   ' Output:  1  0  0
End With