Prod.: Engine, ver.: 6, ID: 60000589, HowTo : How to get the vdAttrib's Prompt string like in version 5

HowTo : How to get the vdAttrib's Prompt string like in version 5

Article60000589
TypeHowTo
ProductEngine
Version6
Date Added7/31/2008
Submitted byMarc Seguin
Keywords

Subject

How to get the vdAttrib's Prompt string like in version 5

Summary

How to get the Prompt string like in version 5

Solution

Private Sub cmdShowPromptString_Click()
    'In version 6 Prompt String is a property of the vdAttribDef object which is in the block.
    'When an insert is created then Attrib objects are created from the Attribute Definitions of the block.
    'So in order to get the Prompt string you have to search the block and find the Attribute Definition and then get the prompt string
   
    Dim vInsert As vdInsert
    Dim vBlock As vdBlock
    Dim myattribdef As vdAttrib
    'Get the insert
    Set vInsert = vDraw.ActiveDocument.ActiveLayOut.Entities(0)
    'Get the block
    Set vBlock = vDraw.ActiveDocument.Blocks.FindName(vInsert.BlockName)
   
    If (Not vBlock Is Nothing) Then
        'Circle the items of the block to Find the Attrib Definition and get the Prompt String
        Dim i As Integer
        For i = 0 To vBlock.Count - 1
            If (vBlock.Item(i).Type = "VDATTRIBDEF") Then
                Set myattribdef = vBlock.Item(i)
                MsgBox "PromptString = " & myattribdef.PromptString
            End If
        Next i
    End If
End Sub