• Skip to main content
  • Skip to primary sidebar
  • Skip to footer

bVisual

  • Home
  • Services
    • How Visio smartness can help your business
    • Visio visual in Power BI
    • Visio Consulting Services
    • Visio Bureau Services
    • Visio Training and Support Services
  • Products
    • LayerManager
    • visViewer
    • Metro Icons
    • Rules Tools for Visio
    • The Visio 2010 Sessions App
    • Multi-Language Text for Visio
    • Document Imager for Visio
    • multiSelect for Visio
    • pdSelect for Visio
  • Case Studies
    • Case studies overview
    • Visualizing Construction Project Schedules
    • Visio Online Business Process Mapping
    • Nexans Visio Template
    • VRA makes the case for Prudential
    • CNEE Projects, WorldCom
    • Chase Manhattan Bank
  • News
    • Recent news
    • News archive
  • Resources
    • My session and other Visio sessions at MSIgnite 2019
    • Innovative uses of Visio Lists
    • Vision up your Visio diagrams
    • Power up your Visio diagrams
    • Mastering Data Visualization with Microsoft Visio
    • Microsoft Visio Business Process Diagramming and Validation
    • The Visio 2010 MVP Sessions
    • Visualizing Information with Microsoft Visio
    • Visio Web Learning Resources
  • Blog
    • Browse blog articles
    • Visio Power BI articles
    • Visio for Web articles
    • Visio blog on Orbus website
    • A history of messaging and encryption
  • About us
    • About bVisual
    • Testimonials
    • Bio of David Parker
    • Contact Us
    • Ariba Network
You are here: Home / Visio / Displaying Document Fonts

Published on October 27, 2007 by David Parker

Displaying Document Fonts

There have been some posts recently about fonts may not displaying correctly in Visio, the Viewer, or in exports to PDF or XPS.  So, I thought it would be good to be have a bit of code that enables you to see all of the different fonts on a Visio page.  You can then use it to select a font, or to check how they are seen in different formats.

image

The following code will divide the active Visio page into three columns, creating a separate shape for each font name in order.  The font index and name are displayed in the particular font, but the ScreenTip of each shape displays the information, just in case you can’t read it in the shape!

Public Sub DisplayFonts()
Dim fnt As Visio.Font
Dim shp As Visio.Shape
Dim cols As Integer
Dim col As Integer
Dim maxRows As Integer
Dim row As Integer

Dim x1 As Double
Dim y1 As Double
Dim x2 As Double
Dim y2 As Double
Dim width As Double
Dim height As Double

cols = 3
col = 0
maxRows = CInt(1 + (Visio.ActiveDocument.Fonts.Count / cols))
width = ((Visio.ActivePage.PageSheet.Cells(“PageWidth”).ResultIU – _
Visio.ActivePage.PageSheet.Cells(“PageLeftMargin”).ResultIU – _
Visio.ActivePage.PageSheet.Cells(“PageRightMargin”).ResultIU) / cols)
height = ((Visio.ActivePage.PageSheet.Cells(“PageHeight”).ResultIU – _
Visio.ActivePage.PageSheet.Cells(“PageTopMargin”).ResultIU – _
Visio.ActivePage.PageSheet.Cells(“PageBottomMargin”).ResultIU) / maxRows)

For Each fnt In Visio.ActiveDocument.Fonts

If row Mod maxRows = 0 Then
col = col + 1
End If

row = row + 1
x1 = Visio.ActivePage.PageSheet.Cells(“PageLeftMargin”).ResultIU + (col – 1) * (width)
y1 = Visio.ActivePage.PageSheet.Cells(“PageHeight”).ResultIU – _
Visio.ActivePage.PageSheet.Cells(“PageTopMargin”).ResultIU – _
((row – ((col – 1) * maxRows) – 1) * height)
x2 = x1 + (Visio.ActivePage.PageSheet.Cells(“PageWidth”).ResultIU / cols)
y2 = y1 + height
Set shp = Visio.ActivePage.DrawRectangle(x1, y1, x2, y2)
shp.Text = fnt.id & vbTab & fnt.Name
shp.Cells(“Para.HorzAlign”).Formula = “=0”
shp.Cells(“Geometry1.NoFill”).Formula = “=1”
shp.Cells(“Geometry1.NoLine”).Formula = “=1”
shp.Cells(“Char.Size”).Formula = “=8 pt”
shp.Cells(“Char.Font”).Formula = “=” & CStr(fnt.id)
shp.Cells(“Comment”).Formula = “=””” & fnt.id & vbCrLf & fnt.Name & “”””
Next
End Sub

Related

Filed Under: VBA, Visio

About David Parker

David Parker has 25 years' experience of providing data visualization solutions to companies around the globe. He is a Microsoft MVP and Visio expert.

Reader Interactions

Comments

  1. [email protected] says

    February 18, 2015 at 11:40 pm

    I was unable to get this to work, the width and height sections were all in red, real shame as this is exactly what I was looking form.

    Reply
    • davidjpp says

      March 18, 2015 at 11:34 am

      Ah, I see what you mean. When you copy and paste into the VBA editor, the “-” characters must have a different ASCII code. I was able to fix this by just replacing the “-” characters with the one on my keyboard … then the red disappeared and the code compiled and ran.

      Reply

Trackbacks

  1. More about Visio document fonts | bVisual - for people interested in Microsoft Visio says:
    July 15, 2016 at 3:20 pm

    […] in 2007, I wrote an article about Visio Document fonts ( see Displaying Document Fonts ), but I did not notice the importance of the screenshot that shows the fonts with the IDs from 10 […]

    Reply

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

Primary Sidebar

Sign up for our newsletter

No spam. Unsubscribe anytime. Get email updates whenever we publish new blog posts.

  • LinkedIn
  • Twitter

Recent Posts

  • Displaying Visio Number Shapes data clearly
  • Using Visio Org Chart Wizard to work with Exchange Online
  • Overcoming ‘We can’t open your file in Visio because it exceeds the shape count limit’ in Power BI
  • Visio news from MS Ignite 2019
  • Clarity Videos Re-boot

Categories

Tags

Accessibility Add-Ins Connectors Data Export Data Graphics Data Import DataRecordset Data Visualizer Educational Excel FM GraphDatabase Hyperlinks Icons Icon Sets JavaScript Layers Legend Link Data to Shapes Macros MSIgnite MVP Office365 Org Chart PowerApps PowerBI PowerQuery Processes Scales Shape Data ShapeSheet ShapeSheet Functions SharePoint 2013 SQL Validation VBA Video Visio Visio 2007 Visio 2013 Visio Pro for Office365 Visio Services Visio Viewer Web Webinar

Footer

bVisual Profile

The UK-based independent Visio consultancy with a worldwide reach. We have over 25 years experience of providing data visualization solutions to companies around the globe.

Learn more about bVisual

  • LinkedIn
  • Twitter

Search this website

Recent posts

  • Displaying Visio Number Shapes data clearly
  • Using Visio Org Chart Wizard to work with Exchange Online
  • Overcoming ‘We can’t open your file in Visio because it exceeds the shape count limit’ in Power BI
  • Visio news from MS Ignite 2019
  • Clarity Videos Re-boot

Sign up for our newsletter

No spam. Unsubscribe anytime. Get email updates whenever we publish new blog posts.

Copyright © 2019 bVisual Ltd. All rights reserved. · Privacy policy · Terms and conditions