I wrote a post a few years ago entitled How to Run VBA Macros from a Ribbon Button in Visio 2010, and was recently asked how to add the custom buttons to an existing tab. Well, it got me thinking that I don’t really like having any VBA code in my Visio diagram documents, so I thought I would explain how all the code can be in a macro-enabled stencil so that it can be used with many different diagram documents. It turned out to be a very easy modification….
[Read more…] about Adding Macro Ribbon Buttons to Visio Documents from a StencilVBA
Bi-directional Labels on Off-Page Grid References
I have previously written about using off-page references and labelled page grids in Visio, see A Page Grid with Labels and Page Grids and Off Page References, however a reader pointed out that the label on the Off-Page Reference shape is duplicated on both ends. This is not always ideal, however it is all I could do using just ShapeSheet formulas alone. So, in this article, I show how a VBA macro can enhance the reciprocal labels on the twin Off-Page Reference shapes, and they automatically update if either end is moved between grids. This is especially useful in electrical wiring diagrams, but the principal can be adapted for other purposes.
[Read more…] about Bi-directional Labels on Off-Page Grid ReferencesAssigning Visio Shapes to Layers from Excel Table
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 TableReplacing 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