ActiveLayout Property (ActiveX)

Specifies the active layout.

Supported platforms: Windows only

Signature

VBA:

object.ActiveLayout
object

Type: Document

The object this property applies to.

Property Value

Read-only: No

Type: Layout

The layout that is currently active for the drawing.

Remarks

No additional remarks.

Examples

VBA:

Sub Example_ActiveLayout()
    ' This example cycles through the documents collection
    ' and uses the ActiveLayout object to list the active layout
    ' for all open documents.

    Dim DOC As AcadDocument
    Dim msg As String
    
    ' If there are no open documents, then exit
    If Documents.Count = 0 Then
        MsgBox "There are no open documents!"
        Exit Sub
    End If
    
    msg = vbCrLf   ' Start with a space
    
    ' Cycle through documents and determine the active layout name using the
    ' ActiveLayout property of the document object
    For Each DOC In Documents
        msg = msg & DOC.WindowTitle & ": " & DOC.ActiveLayout.Name & vbCrLf
    Next
    
    ' Display results
    MsgBox "The active layouts for the open drawings are: " & msg
End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_ActiveLayout()
    ;; This example cycles through the documents collection
    ;; and uses the ActiveLayout object to list the active layout
    ;; for all open documents.
    (setq acadObj (vlax-get-acad-object))
    (setq docs (vla-get-Documents acadObj))  
    
    (setq msg "")
    
    ;; Cycle through the Documents collection and determine the active layout name using the
    ;; ActiveLayout property of the document object
    (vlax-for each-doc docs
        (setq msg (strcat msg (vla-get-WindowTitle each-doc) ": " (vla-get-Name (vla-get-ActiveLayout each-doc)) "\n"))
    )
    
    ;; Display results
    (alert (strcat "The active layouts for the open drawings are: \n\n" msg))
)