WindowTitle Property (ActiveX)

Gets the title of the document window.

Supported platforms: Windows only

Signature

VBA:

object.WindowTitle
object

Type: Document

The object this property applies to.

Property Value

Read-only: Yes

Type: String

The window title of the document.

Remarks

No additional remarks.

Examples

VBA:

Sub Example_WindowTitle()
    ' This example cycles through the documents collection
    ' and uses the WindowTitle property to create a list of 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 all open drawings and get the window title of each drawing
    For Each DOC In Documents
        msg = msg & DOC.WindowTitle
    Next
    
    ' Display a list of open drawings
    MsgBox "The open drawing titles are: " & msg
End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_WindowTitle()
    ;; This example cycles through the documents collection
    ;; and uses the WindowTitle property to create a list of all open documents.
    (setq acadObj (vlax-get-acad-object))
    (setq doc (vla-get-ActiveDocument acadObj))
    
    ;; If there are no open documents, then exit
    (if (> (vla-get-Count (vla-get-Documents acadObj)) 0)
        (progn
            (setq msg "")
	    
            ;; Cycle through all open drawings and get the window title of each drawing
            (vlax-for DOC (vla-get-Documents acadObj)
                (setq msg (strcat msg "\n" (vla-get-WindowTitle DOC)))
            )
	    
            ;; Display a list of open drawings
            (alert (strcat "The open drawing titles are: " msg))
        )
        (alert "There are no open documents!")
    )
)