About Splitting the Active Viewport (ActiveX)

The active viewport can be split into multiple viewports using the Split method.

This method takes one parameter, the type of configuration to split the viewport into. To specify the window configuration, use one of the following constants that correspond to the default configurations previously shown: acViewport2Horizontal, acViewport2Vertical, acViewport3Left, acViewport3Right, acViewport3Horizontal, acViewport3Vertical, acViewport3Above, acViewport3Below, or acViewport4.

Split a viewport into two horizontal windows

The following example creates a new viewport and then splits the viewport into two horizontal windows.

AutoLISP
(vl-load-com)
(defun c:Ch3_SplitAViewport()
    (setq acadObj (vlax-get-acad-object)
          doc (vla-get-ActiveDocument acadObj))
  
    ;; Create a new viewport
    (setq viewportsCollection (vla-get-Viewports doc)
          vportObj (vla-Add viewportsCollection "TEST_VIEWPORT"))

    ;; Split vportObj into 2 horizontal windows
    (vla-Split vportObj acViewport2Horizontal)

    ;; Now set vportObj to be the active viewport
    (vla-put-ActiveViewport doc vportObj)
)
VBA (AutoCAD Only)
Sub Ch3_SplitAViewport()
  ' Create a new viewport
  Dim vportObj As AcadViewport
  Set vportObj = ThisDrawing.Viewports.Add("TEST_VIEWPORT")

  ' Split vportObj into 2 horizontal windows
  vportObj.Split acViewport2Horizontal

  ' Now set vportObj to be the active viewport
  ThisDrawing.ActiveViewport = vportObj
End Sub