Linking Shape Data to a Text Box

Started by jonnyvbuk, January 18, 2016, 02:51:36 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

jonnyvbuk

Hi,

I'm trying to link a text box with shape data from a shape. I know you can insert a field to the text box, such that when you update the shape data it updates the text in the text box, however if you then manually edit the text, the link is broken. Does anyone know of a way to make this link so that either can be edited, and the link kept? I'm using Visio 2007. Ideally I don't want to use VBA at all, as you can't attach the VBA to a shape, incase it gets moved somewhere else or something.

Thanks!

Surrogate

#1
1. select shape with shape data
2. press keys Ctrl+F9
3. select option "shape data"


jonnyvbuk

Thanks for the reply, but as previously stated, the problem with this, is that if you then go and manually edit the text of the shape, this doesn't go back to the shape data, and breaks the link to shape data, such that if you then change the shape data again, the text is left unchanged. I know you can essentially do this using Data Graphics, however I would prefer to have a textbox that I can manipulate more easily, especially via shapesheet

Yacine

I think you should better explain the expected behaviour.
Either there's a field displayed or manually edited text. What are you trying to do?
Are you even wanting to edit the field by editing the text of the shape?
Yacine

jonnyvbuk

I want a shape, with shape data, and a separate text box to display this shape data.

If the shape data is changed, it should update the text box.

If the textbox is updated, it should update the shape data.

Doing either of these actions should not prevent the other from happening.

The first can be achieved by inserting a field into the textbox, as shown by Surrogate. However, this does not achieve the second.

The second can be achieve by setting the Prop shapesheet cell to be the text of the textbox. However, this does not work for the first.

I am struggling to find a way to achieve these two simultaneously.

zones-info

Looking for the answer to the above.  Facing the same problem.  Need to be able to edit shape data using double click on the shape or using Shape Data UI.

As stated above, if a user change it using double-click, shape data do not get updated and Text Field values are blank out. 

Here are my steps used:

1- Select my shape
2- Right click on it and select -> Data-> Define new Shape Data
3- Enter few fields
4- Use Insert-> Field -> Shape Data -> Select one of my field to be display on my shape
5- Browse ShapeSheet on selected shape -> See Text Field added with:
     Format : =FIELDPICTURE(0)
     Value   :=Prop.Row_1
6- The shape now contains and display on my shape what I place into Prop.Row1
7- I double click on my shape to edit the text
8- Update is done and my Shape Data still show my old data and not the new one I just type using double click on my shape

Like the above, I want user be able to change shape data without using Shape Data UI but double clicking on the shape itself.



wapperdude

Direct editing the text clubbers any formula.  Not aware of anyway to prevent that.  To keep  shape data, you can protect shape and disable text edit.  Then, in shapesheet, enter docmd(1312) in the event double click cell.  This will bring up the shape data entry UI and preserve functionality.

Wapperdude
Visio 2019 Pro