Active Property (ActiveX)

Determines if the document is the active document for the session.

Supported platforms: Windows only

Signature

VBA:

object.Active
object

Type: Document

The object this property applies to.

Property Value

Read-only: Yes

Type: Boolean

Determines if the document is the active document for the session.

Remarks

No additional remarks.

Examples

VBA:

Sub Example_Active()
    ' This example creates two new drawings and determines
    ' which of the drawings is the active drawing.
    
    Dim NewDrawing1 As AcadDocument
    Dim Newdrawing2 As AcadDocument
    Set NewDrawing1 = ThisDrawing.Application.Documents.Add("")
    Set Newdrawing2 = ThisDrawing.Application.Documents.Add("")
    
    Dim activeStatus As String
    Dim drawing As AcadDocument
    activeStatus = ""
    For Each drawing In ThisDrawing.Application.Documents
        If drawing.Active Then
                activeStatus = activeStatus & drawing.Name & " is active." & vbCrLf
        Else
                activeStatus = activeStatus & drawing.Name & " is not active." & vbCrLf
        End If
    Next drawing
    MsgBox activeStatus
End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_Active()
    ;; This example creates two new drawings and determines
    ;; which open drawing is the active drawing.
    (setq acadObj (vlax-get-acad-object))
    (setq docs (vla-get-Documents acadObj))

    (setq NewDrawing1 (vla-Add docs ""))
    (setq NewDrawing2 (vla-Add docs ""))

    (setq activeStatus "")
  
    (vlax-for each-doc docs
      (princ (vla-get-Active each-doc))
        (if (= (vla-get-Active each-doc) :vlax-true)
           (setq activeStatus (strcat activeStatus (vla-get-name each-doc) " is active.\n"))
           (setq activeStatus (strcat activeStatus (vla-get-name each-doc) " is not active.\n"))
        )
    )

    (alert activeStatus)
)