3

I'm hoping to use VBA to change the font style of the texts in shapes(from Calibri to Verdana). Currently I have (a snippet of the code)

Visio.ActivePage.Shapes(1).Characters.CharProps(visCharacterFont) = 235# 

235 is the font index for Verdana in my system. However, the font index is very unstable and can change on different computers. Is there a way to change the font style by font name instead, e.g. ...="Verdana"? It's possible in excel, but I couldn't find similar syntax in Visio. Thanks in advance!

Martijn Pieters
  • 1,048,767
  • 296
  • 4,058
  • 3,343
qwer
  • 31
  • 2

1 Answers1

3

You can check what is ID for Verdana font on current PC

Dim Verdana_ID As Integer
Verdana_ID = ActiveDocument.Fonts.Item("Verdana").ID

And after this step set this ID as character's font

Visio.ActivePage.Shapes(1).Characters.CharProps(visCharacterFont) = Verdana_ID
Surrogate
  • 1,466
  • 2
  • 11
  • 13