Hello Mike,
The answer is yes, you did. Normally you would edit the Shape Data (custom
properties) and then add an inserted field to hold the respective text. For
example (assuming you already have a shape with a custom property name
MyCellName):
1) With the shape selected press F2 to edit the text
2) From the menu select Insert / Field...
3) From the Field dialog select Shape Data (or Custom Property) from the
category listbox on the left and 'MyCellName' from the field name listbox on
the right. Click OK.
4) Select your shape again and then Window / Show ShapeSheet and navigate
down to the Events section.
5) In the Events section add the following formula to the EventDblClick
cell: =DOCMD(1312) This will change the double click behaviour to open
the Custom Properties dialog instead of text editting.
Now that's not much good for your existing problem, so a little code might
help. Take a look at this link and then let me know if you have any
questions:
http://visualsignals.typepad.co.uk/vislog/2007/10/just-for-starte.html
....and here's the code, which you can paste into the 'ThisDocument' class
and run from there (make sure you have your shapes selected before you
actually run the code):
Private Sub TextToProps()
Dim shp As Shape
Dim i As Integer
Dim sText As String
Dim sel As Selection
Dim vCell As Cell
Dim sPropName As String
Dim iRow As Integer
sPropName = "MyCellName"
Set sel = ActiveWindow.Selection
For i = 1 To sel.Count
Set shp = sel(i)
'Get the original text
sText = shp.Text
shp.Text = ""
'Check property exists and if
'not add it to the shape
If shp.CellExists("Prop." & sPropName, 0) = True Then
iRow = shp.CellsRowIndexU("Prop." & sPropName)
Else
iRow = shp.AddNamedRow(visSectionProp, sPropName, visTagDefault)
End If
shp.CellsSRC(visSectionProp, iRow, visCustPropsLabel).FormulaU = "=""" &
sPropName & """"
shp.CellsSRC(visSectionProp, iRow, visCustPropsType).FormulaU = 0
shp.CellsSRC(visSectionProp, iRow, visCustPropsValue).FormulaU = "=""" &
sText & """"
'Now add the inserted field
With shp.Characters
.Begin = 0
.End = 0
.AddCustomFieldU "Prop." & sPropName, visFmtNumGenNoUnits
End With
Next i
End Sub
Hope that helps.
Best regards
John
John Goldsmith (Visio MVP)
www.visualSignals.typepad.co.uk
www.visualSignals.co.uk