Finding (& changings) a shapes font.

Started by kevinleesmith, April 04, 2020, 06:14:50 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

kevinleesmith

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?

wapperdude

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.
Visio 2019 Pro

vojo

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

OldSchool1948

Try this to set the size and font type (
vsoShape.CellsSRC(visSectionCharacter, visRowFirst, visCharacterSize).formula = "=9 pt"
vsoShape.CellsSRC(visSectionCharacter, visRowFirst, visCharacterFont).formula = "=17"

wapperdude

Visio 2019 Pro