Changing Embedded Visio Report Column Headers

Most Visio users should know that there is a built-in basic report writer. I use it often, but I do get frustrated sometimes. I wrote a chapter about it in my 2007 book (see ), where I explained how you can edit the XML of an external report to change the column headers, but this can be a bit of a pain if the report is embedded in you document. Therefore, I have written some VBA code to provide the ability to edit embedded report column headers.

For example, here is a standard report for equipment within a rack:

As you can see, there are four columns:

  • <X Location>
  • <Y Location>
  • Height in U’s
  • <Master Name>

These are the default column headers that you can select using the Report Definition Wizard. The angle brackets, “<…>”, denote that these are not Shape Data or User-defined Cells, but are one of the selected other properties.

I also grouped by then <X Location>, which is the easiest way of grouping by each Rack:

Finally, I sorted by the <Y Location> descending, because it is easier to see the correlation with the Rack elevations.

However, the header text of each these columns do not suit my report, so I want to change them. You can

I have created a small VBA project in a Visio stencil, which you can download from!AoRdXTjKEAo1im91GIZT28KeEDZk

The VBA project within the stencil includes two modules from the Visio SDK Sample Code library (modFormulaToString and modStringToFormulaForString) but also has basic classes for a report definition and report fields:

The code required a reference to Microsoft XML (my latest version is v6.0):

The Report Definitions are stored as strings within User-defined cells in the document’s ShapeSheet:

The code parses the XML text to create objects for each field in each report, then presents them in a form for you to select display names to edit.

If you save this stencil to your “My Shapes” folder (or somewhere else where your Visio looks for stencils), then you can simply open the stencil when you want to use it.

The stencil has just one public sub function, ListReports, which can be easily run from the Macros dialog

This will present a list of all of the reports within the document.

Notice that there are three columns in the Fields list box. The first column is just the display order, and the second column is the internal Name of the column, followed by the DisplayName. So, for example, the X Location column is actually known as PINXINFO internally.

You can then edit the Display Name for each of the columns, as required, and then Save the changes.

Then, when you run the report again, you will see that the column headers have been changed accordingly.

Fortunately, these changes are persisted in the report definition text, so you can use both the built-in Reports Definition Wizard and this VBA Report Enhancer whenever you like.


7 Responses to “Changing Embedded Visio Report Column Headers”

  1. Al Edlund Says:

    Nicely done (as always)

  2. Jeanette Says:

    Is there a way to add page number and a hyperlink to these reports?that way you go have an index that could take you to a selected item.

    • davidjpp Says:

      You can get yor reports to display the Page number and/or Page name, but you need to add either Shape Data or User-defined cells to hold this. I would normally do this on the master of the shapes … before Linking to Data.
      The formulas are

      I create a visual index by using the “Off-page reference” shape from the Basic FLowchart Shapes stencil.

  3. Ana Says:

    Is there any way to include in the report the different hyperlinks in the shapes?

    • davidjpp Says:

      Unfortunately not. The Visio reporting tool does not include that feature. It is fairly trivial to do in code, for example:
      Public Sub ListHyperlinks()
      Dim shp As Visio.Shape
      Dim hyp As Visio.Hyperlink

      For Each shp In Visio.ActivePage.Shapes
      For Each hyp In shp.Hyperlinks
      Debug.Print shp.Name, hyp.Row, hyp.Address, hyp.SubAddress, hyp.Description
      End Sub

  4. Updating data sources from #Visio using #MSFlow … easily! | bVisual - for people interested in Microsoft Visio Says:

    […] and export a table of values of Shape Data, User-defined Cells, size, position, and more. See Changing Embedded Visio Report Column Headers for […]

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.


O365 and SharePoint

Simplify Tasks

Want to learn the simple way?

Paul Turley's SQL Server BI Blog

sharing my experiences with the Microsoft data platform, SQL Server BI, Data Modeling, SSAS Design, Power Pivot, Power BI, SSRS Advanced Design, Power BI, Dashboards & Visualization since 2009

John Goldsmith's visLog

be smart, be clear, be visual ...

Mo's blog

Personal views on Dynamics 365 for Operations and Technical Architecture.

Chris Webb's BI Blog

Microsoft Power BI, Analysis Services, MDX, DAX, M, Power Pivot and Power Query

Azure Solutions for Office 365, and more...

Rob Fahrni



Life with Visio and other Microsoft Toys!

Nilsandrey's Weblog

Just another weblog

Things that Should be Easy

Every so often (too often in the IT industry) I encounter things that should have been very easy to do but turned out to be far too complicated. My favorite topics include SharePoint, .Net development, and software architecture, especially distributed systems.

Visio Guy

Smart graphics for visual people

%d bloggers like this: