• 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
    • Visio Shape Report Converter
    • SS Plus
    • 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
    • Using Visio in Education for GIS
    • Visualizing Construction Project Schedules
    • Visio Online Business Process Mapping
    • Nexans Visio Template
    • CNEE Projects, WorldCom
    • Chase Manhattan Bank
  • News
    • Recent news
    • News archive
  • Resources
    • Articles➡
      • ShapeSheet Functions A-Z
      • Comparing Visio for the Web and Desktop
      • Customising Visio Shapes for the Web App
      • Key differences between the Visio desktop and web apps
      • Using the Visio Data Visualizer in Excel
      • Using Visio in Teams
      • Creating Visio Tabs and Apps for Teams with SharePoint Framework (SPFx)
      • Designing Power Automate Flows with Microsoft Visio
      • Innovative uses of Visio Lists
    • Webcasts ➡
      • Visio in Organizations
      • My session and other Visio sessions at MSIgnite 2019
      • Power up your Visio diagrams
      • Vision up your Visio diagrams
      • The Visio 2010 MVP Sessions
    • Visio Web Learning Resources
    • Books➡
      • Visualize Complex Processes with Microsoft Visio
      • Mastering Data Visualization with Microsoft Visio
      • Microsoft Visio Business Process Diagramming and Validation
      • Visualizing Information with Microsoft Visio
  • Blog
    • Browse blog articles
    • Visio Power BI articles
    • Visio for Web articles
    • A history of messaging and encryption
  • About us
    • About bVisual
    • Testimonials
    • Bio of David Parker
    • Contact Us
    • Website Privacy Policy
    • Website terms and conditions
    • Ariba Network
You are here: Home / Shape Design / Shape Reports / Changing Embedded Visio Report Column Headers

Published on July 31, 2011 by David Parker

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 https://bvisual.net/resources/visualizing-information-with-microsoft-visio/ ), 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 https://1drv.ms/u/s!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, of any report that is saved in the document, 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.

Related

Filed Under: Shape Reports, VBA, Visio 2010

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. Al Edlund says

    August 7, 2011 at 12:20 pm

    Nicely done (as always)
    al

    Reply
  2. Jeanette says

    January 10, 2013 at 2:38 pm

    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.

    Reply
    • davidjpp says

      January 11, 2013 at 5:13 pm

      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
      =GUARD(PAGENUMBER())
      =GUARD(PAGENAME())

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

      Reply
      • Jeanette says

        January 11, 2013 at 7:18 pm

        Can you show please me an example? Thanks!

        Reply
  3. Ana says

    October 28, 2013 at 6:06 pm

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

    Reply
    • davidjpp says

      November 28, 2013 at 10:26 am

      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
      Next
      Next
      End Sub

      Reply
  4. perry says

    January 21, 2020 at 4:23 pm

    Compile error: user-defined type not defines (celDOMDocument As DOMDocument)
    Also, do not see any user cells in the document shapesheet defining the reports
    visio 2007

    Reply
    • David Parker says

      January 22, 2020 at 12:24 pm

      It seems that the DOMDocument objects are now DOMDocument60, so adding the 60 to the end of each Dim line fixed the compile problem, but then there was an issue that Microsoft chnaged the way that the SelectSingleNode(..) method works… https://social.msdn.microsoft.com/Forums/en-US/5ae834d2-59ed-44d6-b6da-0a7bf5795caa/issues-with-selectsinglenode-in-vba-w-msxml6?forum=xmlandnetfx
      So, I have updated the vss file now. Please re-download and try again.

      Reply
    • David Parker says

      January 22, 2020 at 12:26 pm

      Also, the code only checks report definitions that are saved in the document. So try Modify for a Microsoft report definition, and then Save in the drawing at the end ….

      Reply
      • perry says

        January 22, 2020 at 9:33 pm

        I downloaded the stencil again. Got the same error, so I added the “60” as you stated above.
        It went a little further, then got the old “variable unset” error on this line…
        rpt.Name = celDOMDocument.SelectSingleNode(“/VisioReportDefinition/Name”).Text
        suspect it would have occurred again.
        Also, even after saving the report in the document, I still see nothing in the pages shapesheet that looks anything like a report definition.

        Reply
        • perry says

          January 22, 2020 at 9:40 pm

          oops, nevermind on the report in drawing. I was looking at the page shapesheet NOT the document shapesheet where it was!

          Reply
  5. Peter Bulkeley says

    December 9, 2020 at 5:28 am

    Interesting stuff Mr Parker.

    Is it possible to produce reports in a transposed manner? I want to generate a mass balance table with the properties( data headings) in rows and the shape data in columns rather than the other way around.

    Regards,
    Peter

    Reply
    • David Parker says

      December 16, 2020 at 9:06 pm

      Not really possible directly, but this is quite possible in Excel once you have exported the data from Visio.

      Reply

Trackbacks

  1. Updating data sources from #Visio using #MSFlow … easily! | bVisual - for people interested in Microsoft Visio says:
    August 15, 2017 at 11:33 am

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

    Reply

Leave a Reply Cancel reply

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

Primary Sidebar

  • LinkedIn
  • Twitter

Recent Posts

  • Fixing dimensions of 2D shapes
  • Merging Linked Data from Similar Tables
  • Smart Radio Buttons and Check Boxes in Visio
  • Using Button Face Ids in Visio
  • Grid Snapping Revisited

Categories

Tags

Accessibility Add-Ins Connectors Containers Data Export Data Graphics Data Import Data Visualizer Educational Excel GraphDatabase Hyperlinks Icon Sets JavaScript LayerManager Layers Legend Link Data to Shapes Lists MSIgnite MVP Office365 Org Chart PowerApps PowerBI PowerQuery Processes Setup and Deployment Shape Data Shape Design ShapeSheet ShapeSheet Functions SharePoint 2013 SQL Teams Validation VBA Video Visio Visio 2007 Visio for the Web Visio Online Visio Services Visio Viewer 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

  • Amazon
  • E-mail
  • Facebook
  • LinkedIn
  • Twitter
  • YouTube

Search this website

Recent posts

  • Fixing dimensions of 2D shapes
  • Merging Linked Data from Similar Tables
  • Smart Radio Buttons and Check Boxes in Visio
  • Using Button Face Ids in Visio
  • Grid Snapping Revisited

Copyright © 2025 · Executive Pro on Genesis Framework · WordPress · Log in