how to change and add the Custom Properties of stencil?

K

Kelvin Chong

Hai,

I found the method for return the value of Custom
Properties with program but I can find out any method to
change and add the Custom Properties with program.

Can you give me some guide and webpage about editting the
Custom Properties with program?

Thank you.

Regards,
Kelvin Chong
 
A

al

i use the following for when I add a shape to a network
diagram.

you should consider also using the visio sdk on the msdn
group since it is common to run into problems when first
learning to add values to cells....

al


*********************************************************

Private Sub pagObj_ShapeAdded(ByVal visShape As IVShape)

Dim strShapeUniqueID As String
Dim intResult As Integer
Dim blnPropAdded As Boolean
Dim blnValueAdded As Boolean
Dim shpCell As Visio.Cell


On Error GoTo ErrorHandler
g_blnCostScan = False
blnPropAdded = False

' for everything that has a cost we want a uniqueid
and a date last modified
If visShape.CellExists("Prop.Cost", False) Then
' make sure a unique id is assigned to the shape so
' that we can save/recall it to/from the database
strShapeUniqueID = visShape.UniqueID
(visGetOrMakeGUID)
blnPropAdded = AddCustomProperty
(visShape, "DTModified", "DTModified", "DTModified",
visPropTypeDate, "", "DTModified", False, False, "DBSync")
If blnPropAdded = True Then
' Debug.Print "Prop added"
Set shpCell = visShape.Cells("prop.DTModified")
SetCellValueToString shpCell, Now
Else
' Debug.Print "Prop not added"
End If
blnPropAdded = False
' now create the database record
subCreatePropertyRecord (strShapeUniqueID)
' then fill it in
subCustPropRecUpdate strShapeUniqueID, visShape
End If

If visShape.CellExists("prop.ipaddress", False) And
Not visShape.CellExists("Prop.VLAN_Id", False) Then
' Debug.Print "shape has ip address and no vlan_id"
blnPropAdded = AddCustomProperty
(visShape, "VLAN_Id", "VLAN_Id", "VLAN_Id",
visPropTypeString, "", "VLAN ID", False, False, "Network")
If blnPropAdded = True Then
' Debug.Print "Prop added"
Set shpCell = visShape.Cells("prop.vlan_id")
SetCellValueToString shpCell, "100"
Else
' Debug.Print "Prop not added"
End If
End If

' Debug.Print "shape added"

ErrorHandler:

If Err > 0 Then
Debug.Print "Err in ShapeAddedEvent is " & Err & " " &
Err.Description
Resume Next
End If

End Sub
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top