Author Topic: Setting a Text Shape's text value  (Read 2365 times)

0 Members and 1 Guest are viewing this topic.

qholmes

  • Full Member
  • ***
  • Posts: 81
Setting a Text Shape's text value
« on: July 16, 2018, 03:49:26 PM »
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

  • Hero Member
  • *****
  • Posts: 1087
    • ShapeSheet™ Knowledge Base
Re: Setting a Text Shape's text value
« Reply #1 on: July 16, 2018, 04:32:10 PM »
what you mean as "text shapes" ?

qholmes

  • Full Member
  • ***
  • Posts: 81
Re: Setting a Text Shape's text value
« Reply #2 on: July 16, 2018, 04:33:47 PM »
like a text box.

Q

Surrogate

  • Hero Member
  • *****
  • Posts: 1087
    • ShapeSheet™ Knowledge Base
Re: Setting a Text Shape's text value
« Reply #3 on: July 16, 2018, 04:40:55 PM »
Just rectangle without border-line ?

qholmes

  • Full Member
  • ***
  • Posts: 81
Re: Setting a Text Shape's text value
« Reply #4 on: July 16, 2018, 04:45:52 PM »
On the Home Tab and under Tools the Text tool.

« Last Edit: July 16, 2018, 06:53:52 PM by wapperdude »

wapperdude

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 3855
  • Ideas Visio-lized into solutions
Re: Setting a Text Shape's text value
« Reply #5 on: July 16, 2018, 06:27:03 PM »
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
« Last Edit: July 16, 2018, 06:57:24 PM by wapperdude »
Visio 2019 Pro

qholmes

  • Full Member
  • ***
  • Posts: 81
Re: Setting a Text Shape's text value
« Reply #6 on: July 16, 2018, 07:02:21 PM »
Perfect!!!!!!!!!!!!!!!!

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

Awesome!!!!

Thanks

Q

qholmes

  • Full Member
  • ***
  • Posts: 81
Re: Setting a Text Shape's text value
« Reply #7 on: July 16, 2018, 07:06:30 PM »
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

  • Full Member
  • ***
  • Posts: 81
Re: Setting a Text Shape's text value
« Reply #8 on: July 17, 2018, 07:40:31 AM »
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

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 3855
  • Ideas Visio-lized into solutions
Re: Setting a Text Shape's text value
« Reply #9 on: July 17, 2018, 09:39:45 AM »
Oh, good job!

Sorry my answer was a bit incomplete.
Visio 2019 Pro

qholmes

  • Full Member
  • ***
  • Posts: 81
Re: Setting a Text Shape's text value
« Reply #10 on: July 17, 2018, 09:41:18 AM »
Are you kidding.. you got me there. Thanks!!!!!!!!!!!!!!

Q

Rob.Bradley

  • Newbie
  • *
  • Posts: 1
Re: Setting a Text Shape's text value
« Reply #11 on: July 27, 2018, 08:47:42 AM »

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

  • Full Member
  • ***
  • Posts: 81
Re: Setting a Text Shape's text value
« Reply #12 on: July 27, 2018, 08:52:31 AM »
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

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 3855
  • Ideas Visio-lized into solutions
Re: Setting a Text Shape's text value
« Reply #13 on: July 27, 2018, 09:15:48 AM »
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
« Last Edit: July 27, 2018, 09:20:43 AM by wapperdude »
Visio 2019 Pro

Hey Ken

  • Full Member
  • ***
  • Posts: 227
  • Just This Guy
    • The Pennsylvania Project, with Ken Krawchuk
Re: Setting a Text Shape's text value
« Reply #14 on: July 27, 2018, 02:43:36 PM »
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


Code

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