Reputation: 1
I need to have the name of a visio shape change to a user entered value when the shape is dropped to the page. I have created two shape data fields: Name and State. The name field prompts the user for the name when the shape is dropped and this is the value I would like to have transferred to the actual shape name. The reason for this is so that the shape data field "state" can be changed programmatically using the value assigned to the "Name' field as shown in the code below:
Sub SetStatePassive()
Dim vPag As Visio.Page
Set vPag = Visio.ActivePage
Dim shp As Visio.shape
Set shp = Visio.ActivePage.Shapes("XV 013A")
Dim vCell As Visio.cell
Set vCell = shp.Cells("Prop.State")
vCell.FormulaU = Chr(34) & "Passive" & Chr(34)
End Sub
I have not found a way to change the actual shape name to match the "Name" shape data field automatically.
Is there a way to do this with a shapesheet formula or have the shape trigger some VBA code after the shape data has been defined. Using code to change the name is not a problem, but how can the code be triggered automatically to set the shape name to the shape data field "Name"
Or is their way to get the shape to prompt the user, on drop, to change the shape name directly.
Upvotes: 0
Views: 611