Label Property (ActiveX)

Specifies the content and formatting of menu items as they appear to the user.

Supported platforms: Windows only

Signature

VBA:

object.Label
object

Type: PopupMenuItem

The object this property applies to.

Property Value

Read-only: No

Type: String

The label for the popup menu item.

Remarks

Unlike the Caption property, this property can contain DIESEL string expressions that conditionally alter the labels each time they are displayed.

Examples

VBA:

Sub Example_Label()
    ' This example iterates through the first menu in the menu bar
    ' and displays the label for each menu item.
    
    Dim menuItem As AcadPopupMenuItem
    Dim menuLabel As String
    menuLabel = ""
    
    For Each menuItem In ThisDrawing.Application.MenuBar.Item(0)
        menuLabel = menuLabel & menuItem.Label & vbCrLf
    Next menuItem
    MsgBox menuLabel
    
End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_Label()
    ;; This example iterates through the first menu in the menu bar
    ;; and displays the label for each menu item.
    (setq acadObj (vlax-get-acad-object))
    
    (setq menuLabel "")
    
    (vlax-for menuItem (vla-Item (vla-get-MenuBar acadObj) 0)
        (setq menuLabel (strcat menuLabel (vla-get-Label menuItem) "\n"))
    )

    (alert menuLabel)
)