Error 1002 Object not available.
You’ve referenced a window field object, but the window containing the field currently isn’t open.
To reference a window field in VBA code, the window must be open (its IsLoaded property is True). The window does not need to be visible to reference the window field.
When you reference a window field from outside the current window, it’s good practice to check the window object’s IsLoaded property to ascertain whether the window containing the field is open. The following procedure checks if the window is open using the IsLoaded property. If it is, the procedure sets value of a window field:
Private Sub If CustomerMaintenance.IsLoaded Then 'Reference a window field CustomerMaintenance.ShippingMethod = "UPS BLUE" End If End Sub