ActiveDocument Property (ActiveX)

Specifies the active document (drawing file).

Supported platforms: Windows only

Signature

VBA:

object.ActiveDocument
object

Type: Application

The object this property applies to.

Property Value

Read-only: No

Type: Document

The default is drawing.dwg.

Remarks

No additional remarks.

Examples

VBA:

Sub Example_ActiveDocument()
    Dim activeDoc As AcadDocument
    ' Returns current document in AutoCAD
    Set activeDoc = ThisDrawing.Application.ActiveDocument
    MsgBox "The active document is: " & activeDoc.name, vbInformation, "ActiveDocument Example"
End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_ActiveDocument()
    ;; Returns current document in AutoCAD
    (setq acadObj (vlax-get-acad-object))
    (setq activeDoc (vla-get-ActiveDocument acadObj))
    (alert (strcat "The active document is: " (vla-get-Name activeDoc)))
)