Count.Char from a SheetShape

Started by sindemic, April 30, 2015, 10:35:40 AM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

sindemic

hy Gurus.
I want the width of Sheet.## is equal the Text-Length which is inside it (so the width could change dynamic)
On the MS-Homepage I found the Characters.CharCount entry. But it doesn't work. it's look like Viso (2013 Professional v15.0.4569.1506)  doesn't know this command.
Maybe there is a Chance to get it through vba like?:
Dim x As Long
x = ActivePage.Shape(##).CharCount

greetings

Visio Guy

Probably something more like shp.Characters.CharCount. And you have to set the characters object to the run that you are interested in. If all of a shape's text has the same formatting, then the shape's text only has one character run. Otherwise, there are as many runs as there are formatting changes. I would read Shape.Characters and look for examples of that.

If you are working inside the ShapeSheet, then you probably only have LEN(ShapeText(TheText)) at your disposal.
For articles, tips and free content, see the Visio Guy Website at http://www.visguy.com
Get my Visio Book! Using Microsoft Visio 2010

Paul Herber

Set the shapesheet cell:

Width = GUARD(MAX(TEXTWIDTH(TheText), 10mm))

This will set the shape's width to the width of the text but with a minimum width of 10mm.
Electronic and Electrical engineering, business and software stencils for Visio -

https://www.paulherber.co.uk/

Visio Guy

Paul, I thought I could count on you to be an inch-guy!  :) :)
For articles, tips and free content, see the Visio Guy Website at http://www.visguy.com
Get my Visio Book! Using Microsoft Visio 2010

Paul Herber

Me? I'm a FFS guy (Furlong/Fortnight/Stone). Not many of us left ...
P.S. There are other meanings of FFS.

Electronic and Electrical engineering, business and software stencils for Visio -

https://www.paulherber.co.uk/

sindemic

Paul, you're awesome.
It works perfectly, thanks!

AAANNNNDDD thanks Visio Guy too ;-)

Paul Herber

Not me, it's a standard formula used in Visio, I stole it from elsewhere and just happened to be first to post it!
Electronic and Electrical engineering, business and software stencils for Visio -

https://www.paulherber.co.uk/

sindemic

:-)
But you know where to look for