Setting a Text Shape's text value

Started by qholmes, July 16, 2018, 08:49:26 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

qholmes

I read a bunch of posts but most are talking about the shape text not a text shapes text.. is it different? not sure. I still could not figure out how to set the text on a text shape.

I have multi shape groups/masters and one of them is a text shape that if possible I would like to set the text on depending on actions in the group/master shape. Do I change the text or just hide and unhide different text shapes. I would rather change the text.

Thanks

Q

Surrogate


qholmes


Surrogate

Just rectangle without border-line ?

qholmes

#4
On the Home Tab and under Tools the Text tool.


wapperdude

#5
Technically, there is no text shape per se.  But, shapes contain a text box.  When you select either of the text tools, then click on a drawing page,and start typing, Visio creates a shape without a border.  The textbox tool, allows you to manipulate and move the textbox independently of the shape, but it still belongs to the shape.

It you want a single shape to have multiple text boxes, then you have to create a group, with a sub shape for each textbox.

To show/hide text, you could use multiple, stacked shapes and show hide text as necessary.  Or, you could use a single shape, some shape sheet functionality, and push appropriate text into textbox.

Attached is example of 2nd method.  The text is defined by the shape data values.  The text selection is determined by the Actions section.  The selected text is pushed into the shape via custom Field Insert formula.

Wapperdude
Visio 2019 Pro

qholmes

Perfect!!!!!!!!!!!!!!!!

I missed the Text Fields group. Everything I had read said there was no way to set text..

Awesome!!!!

Thanks

Q

qholmes

Ok,

How do I get Text Fields to show up? I don't see it on my text box or a generic shape I tried?

Q

qholmes

ok, figured it out. Insert a Field. with User Cell. I had tried to figure this out before. Finally found the proper MS help doc.

That's the part I was missing the whole time.

Thanks

Q

wapperdude

Oh, good job!

Sorry my answer was a bit incomplete.
Visio 2019 Pro

qholmes

Are you kidding.. you got me there. Thanks!!!!!!!!!!!!!!

Q

Rob.Bradley

Quote from: wapperdude on July 16, 2018, 11:27:03 PM

Attached is example of 2nd method.  The text is defined by the shape data values.  The text selection is determined by the Actions section.  The selected text is pushed into the shape via custom Field Insert formula.

Wapperdude

I'm building a legend template for a team to use. How do I ask shape to show Filename as text in specific box? I suspect it is the 4th box 'ObjectKind' in the text fields menu on Spreadsheet but am non-VBA user so do not know code to use!

The other part of this question is what kind of shape is your example? The boxes I have do not have 'Text Field' Section in Shapesheet tool menu.

Many thanks, Rob

qholmes

Any object and use the insert and Field function. It gives you some options. I am sure you can take it from there. This was the clue I could not find myself.

hope it helps.

Q

wapperdude

#13
The Text Field section only appears in the shape sheet after using the Insert> Fields > "whatever" funationality.

I suppose it might be inserted via code...never tried that.

Wapperdude
Visio 2019 Pro

Hey Ken

Wapperdude:

   Funny, but I just wrote a routine to add text fields just this morning.  The method for doing it is non-obvious, and this example only scratches the surface.  The code below will either create or update the first field.  Your mileage may vary.

   - Ken




Public Sub CreateTextField(TheShape As Shape, TheText As String)

Dim TheCharacters As Visio.Characters

If TheShape.CellExists("Fields.Value", 0) Then
Else
    Set TheCharacters = TheShape.Characters
    TheCharacters.Begin = 0
    TheCharacters.End = 0
    TheCharacters.AddCustomFieldU "", visFmtNumGenNoUnits
    End If
   
TheShape.Cells("Fields.Value").Formula = TheText
TheShape.Cells("Fields.Format").Formula = "=FIELDPICTURE(37)"

End Sub


Ken V. Krawchuk
Author
No Dogs on Mars - A Starship Story
http://astarshipstory.com