Visio Guy

Visio Discussions => Programming & Code => Topic started by: kevinleesmith on April 04, 2020, 06:14:50 PM

Title: Finding (& changings) a shapes font.
Post by: kevinleesmith on April 04, 2020, 06:14:50 PM
I know how to set the font family of a shape...
shpObj.Characters.CharProps(visCharacterFont) = ActiveDocument.Fonts.Item("Segoe UI").ID

But I only want to do this on shapes that have a particular font currently.

I cannot read from
shpObj.Characters.CharProps(visCharacterFont)
so I found I can get the font number from trhe shapesheet using
shpobj.Cells("somestring")
The probelm is, not matter how hard I've lookd I cannot find anywhere a list of valid "somestring"s.

So I though I'd look at the shapesheet, which has a Font column in hte Character section, so I tried
shpobj.Cells("Character.Font")
Which produces a "Unexpected end of file" error - which is bizaare!!!!!!

So, how do i READ the font family of a shape?
Title: Re: Finding (& changings) a shapes font.
Post by: wapperdude on April 05, 2020, 06:48:08 PM
Not at my PC, soooo.... here's shapesheet trick:  create a User entry, then, in th cell enter an "=" without the quotes, and scroll thru shape sheet to the cell you want and click on it.   Now scroll back to user cell.  It will show the name of the cell you just selected.

BTW,there is a list of cells available, but I can't access at the moment.net.
Title: Re: Finding (& changings) a shapes font.
Post by: vojo on April 06, 2020, 12:29:24 AM
cell is called char.font   its in the character section below fill section
font is a numerical and is RELATIVE to the fonts on you PC.    so if you use a font call "AAA3" it would be the 3  but if
you later on your PC add font "AAA2" then "AA3" becomes 4.   So its best to stay with fonts like arial, times roman, etc vs adding some new funky font to your PC
Title: Re: Finding (& changings) a shapes font.
Post by: OldSchool1948 on May 15, 2020, 11:51:41 PM
Try this to set the size and font type (
vsoShape.CellsSRC(visSectionCharacter, visRowFirst, visCharacterSize).formula = "=9 pt"
vsoShape.CellsSRC(visSectionCharacter, visRowFirst, visCharacterFont).formula = "=17"
Title: Re: Finding (& changings) a shapes font.
Post by: wapperdude on May 18, 2020, 03:19:53 AM
Here's a list for "something"...names of shape sheet cells...https://docs.microsoft.com/en-us/office/client-developer/visio/cells-visio-shapesheet-reference (https://docs.microsoft.com/en-us/office/client-developer/visio/cells-visio-shapesheet-reference)