This is how I'd do it....I don't think you need to check for clipped.
;;Put all the viewports on the standard layer, including clipped viewports and their clipping boundarys.
(foreach n vportlist
(vla-put-layer n "VPORTS")
(if (setq clipobject (assoc 340 (entget (vlax-vla-object->ename n))))
(vlax-put-property (vlax-ename->vla-object (cdr clipobject))
'layer
"VPORTS"
)
) ; end progn
) ;end foreach
;;purge unused layers
(repeat 2
(vla-purgeall
(vla-get-activedocument (vlax-get-acad-object))
)
)