Visio 2003 - custom property find/replace

K

Kristine

Is it possible to conduct a find/replace that will search the custom
properties of all shapes in a drawing and make appropriate replacements.
 
J

John Goldsmith

Hello Kristine,

Have a go with the following code. I've made a few assumptions: that you
know what custom property cell you want to look in, that you're replacing
the whole cell value, that you replacing a string, that you're only changing
one page at a time..........

Anyway hope this will set you on the right track. Bear in mind also that if
you're changing formulae then you might be better to make the changes in the
Master rather than the instances.

Sub FindMyCustomProps()
Dim pag As Page
Dim shp As Shape
Dim sFindCell As String
Dim sFindText As String
Dim sReplaceText As String

'Change these strings as required
sFindCell = "Prop.MyName"
sFindText = "SearchForThis"
sReplaceText = "ReplaceWithThis"

Set pag = Application.ActivePage
For Each shp In pag.Shapes
If shp.CellExistsU(sFindCell, 0) = True Then
If shp.Cells(sFindCell).ResultStr("") = sFindText Then
shp.Cells(sFindCell).FormulaU = sReplaceText
End If
End If
Next shp

End Sub


Best regards

John


John Goldsmith
www.visualSignals.co.uk
 

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