Active プロパティ(ActiveX)

ドキュメントがセッションでアクティブかどうかを決定します。

サポートされているプラットフォーム: Windows のみ

構文と要素

VBA:

object.Active
object

タイプ: Document

このプロパティが適用されるオブジェクト。

プロパティの値

読み込み専用: はい

タイプ: ブール型

ドキュメントがセッションでアクティブかどうかを決定します。

注意

追加の注意はありません。

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)
)