Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Custom properties to change shape text.

Status
Not open for further replies.

leifgund

Programmer
Dec 17, 2004
1
US
New to Visio VBA. Have extensive VB and VBA experience.
I am having a hard time finding my way around in VBA-Visio. I really miss Excel's macro recorder in Visio.

Here is my problem:

I have a shape consisting of some geometry and 5 text fields.
I have added 5 custom properties, each with the ask cell set to true.
The shape (group of shapes) is in a stencil. When I drop the shape in a document I want the following to happen:
1. Show the custom properties sheet for the user to input properties.
2. User clicks OK
3. Validate input in the custom properties sheet
4. Update the shapes text fields automatically.

1 and 2 works. However inorder to get 3 and 4 to work I have to react to the OK event of the user. I can not figure out how to get it.
I update the text as follows, but need to run the code manually:

Private Sub Document_ShapeAdded(ByVal Shape As IVShape)
Dim strRow As String
Dim i As Integer



If Shape.SectionExists(visSectionProp, False) Then ' there is a custom properties section
strRow = "Prop.row_"
If Shape.Type = visTypeGroup Then ' it's a group
For i = 1 To Shape.Shapes.Count
If Shape.CellExists(strRow & i, False) Then
Shape.Shapes(i + 1).Text = Shape.Cells(strRow & i).ResultStr(0)
End If
Next i
End If
End If

End Sub

Help or information to good tutorials on how to go "under the hood" of the VBA needed.

I am Using Visio 2002 Pro SR1
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top