I work a lot with layers in Visio, and written an add-in, LayerManager, to assist, but I was asked an interesting question recently: How can shapes by assigned to layers automatically from a list in Excel? So, I thought I would present my solution. This particular request was for a Timeline diagram, where the Milestone shapes are to be on specific layers. So, I just used one of the samples provided with Visio.
[Read more…] about Assigning Visio Shapes to Layers from Excel TableVBA
Replacing Images in Visio Shapes by Changing Data
I wrote an article last year about Swapping Images in a #Visio Shape manually, but I want to be able to do this whenever a Shape Data value changes. This is because I use I invariably use shapes linked to data. I also want to be able to have multiple images within a single grouped shape, and all of them changing when their referenced Shape Data values change. I believe that this will be more adaptable for a lot of scenarios than trying to repurpose Data Graphic Icon Sets ( see Make Your Own Visio Data Graphic Icons Sets … automatically). I also discovered that the Shape.ChangePicture(…) function can just as easily work with urls as it can with network file paths, so even more possibilities are opened up! For example, the Visio Online JavaScript API has the ability to overlay an image (see ShapeView.addOverlay(…)).
So, I have created some macros to provide quick and easy selection, positioning and updating of images within a group shape.
I decided to present this article with VBA code rather than my preferred C# so that a stencil could be downloaded to provide instant usability, rather than having to install an add-in. It can be download from Image Utils.vssm, and should then be placed in to My Shapes folder, so that it becomes available to open in Visio. When it is opened, then the macros will need to be enabled.
There are just five public macros:
Temporary Fix for Data Refresh in Visio Click-2-Run
Visio is an enormous application with literally millions of lines of code, so it is inevitable that bugs creep in for time to time, and can lay dormant .. until you really need it! Such an incident happened to me during a project for a large organisation where the latest and greatest build and versions are held up by the internal IT departments until they are sure that there is absolutely nothing hidden inside. In this project, I was given a laptop with Visio Pro for Office 365 to work with … not a problem, even though that moniker already told me that this was a seriously out of date edition, since it has been called Visio Online Plan 2 for quite a while. Anyway, I developed a solution that relies heavily on linked SharePoint lists and document libraries, using a view. The automatic name of these views are very verbose, so I consistently renamed them. Also, I had the same SharePoint Document library view linked more than once, so that I could link multiple rows to shapes, so renaming was, and is, absolutely essential. Several weeks went by, and my solution was working fine, until one day last week, my colleague told me that the Data / Refresh All was failing for him, and for other users. A review of his laptop showed that his Visio version had been updated to build 1708 from 1609 and the refresh was reverting the carefully renamed data recordsets back to the underlying SharePoint view name. My own personal laptop, not the client’s, is at build number 1808, so I will get the real fix from Microsoft soon via the normal channel updates for Click-to-Run.
Gus am bris an là – David A. Edson
My first introduction to the art of Visio development was provided by David Edson, M.Arch. MCP. back in 1996 in Paris. Visio Corporation parachuted him and Mark Davision into that beautiful city to spread the knowledge with a week of intensive ShapeSheet and automation training. Dave was inspirational, and that week set the course for the rest of my life. His enthusiasm for the smartness of Visio and his similar background to my own, as an architect, meant that we immediately connected and understood each other. I stayed at his self-designed house in the woody hills near Seattle in the early days, and he has stayed with me in the England, though I know he would have preferred that it was Scotland, the land of his forefathers.
Dave wrote many books and articles about Visio, and created many videos, so he will live on in the ether for a long time, but many will remember his effortless presentations enthusiastically describing how to make smarter diagrams.
Here is an early example of his work, a simple Back Gammon game, that he created to demonstrate the capabilities of Visio with some VBA code.
Dave was also a great photographer, and connoisseur of single malt whisky, but it will be for his belief in Visio that he will perhaps be best remembered. I recommend that all Visio users worldwide visit his website and download all of the free resources that he provided : (no longer available)
Gus am bris an là – David A. Edson
More secrets of the Visio Legend shape
I was going to do a full post on the special Legend shape in Visio that can automatically count instances of masters on a page, then I found that my good friend Chris Roth, aka VisGuy, had done one some years ago ( see visguy.com/…/legend-shapes). However, I have some extra information that will assist in getting the functionality to work consistently.
Basically, you can make any Master work with the Legend shape by adding the User.visLegendShape = 2 setting into a Master shape, but there are caveats.
- If the name of a Master is changed, then any existing shapes on the page must be re-placed
- The BaseID of each Master must be unique
- If the BaseID is changed (using NewBaseID), then any existing shapes on the page must be re-placed
To demonstrate this, I used the Good and Bad icon shapes from the Legend Shapes stencil.
[Read more…] about More secrets of the Visio Legend shapeOpening an MS Access form from a Visio shape
This article describes how to open a Microsoft Access form at a specific record from a Visio shape. I was an Access developer before I was a Visio developer, and both of the applications have VBA to provide tactical solutions for everyday tasks. Fortunately, it is fairly simple to copy the VBA code from one application to another…
Firstly, I am assuming that both of the desktop applications are open, and although Visio shapes can be linked to Access queries and tables, it is not essential for this solution.