How to provide updates to VISIO+EXCEL project code, without always issuing new versions of the full project files?

Posted on 2013-06-06
Last Modified: 2013-06-07
Part of my visio+excel project contains 'tools' that users can employ to gain additional effects. These tools are vba procedures, and additional tools will be added over time.

I wonder how/whether to update the project files actually held by users, between times that a new version of the project is issued.  

As a vba user, I'd like to assemble the project code in a way that is most accessible to whatever automated updating can be applied later in the project (when more skills may be available).

In terms of user perception now, the speed of response of the project code to user actions does not seem to be a big issue.

Could you:
1. Tell me if any elements of this are really a practical issue this early stage?

   --  If so, can you give some pointer urls for visio and excel?

2. Help me with this memory (if its accurate).  I think I've read David Parker as saying (roughly) ~ that a well-used method for adding code to Visio is by means of .vss files / masters ~  .  I noted the url and lost it!   (And I cant imagine how it would work.)

   --  If this memory is actually true, this suggests that scope for updating /adding code
       in visio can be somewhat different from the methods for excel?

Question by:Kelvin4
  • 3
  • 3
LVL 11

Expert Comment

ID: 39224908
Hi Kelvin,

On the Visio side, it makes sense to put code in a stencil, then call the code from shapes using, for example, the CALLTHIS function in the ShapeSheet. (ie: in an Actions cell, which defines a custom right-click menu item).

If you put VBA in a drawing/template, then every drawing made from that template has a copy of the code, which is an updating nightmare waiting to happen. With code in a stencil, you just replace the stencil. And users can get new versions of shapes too (but shapes already in drawings won't be updated, it's a 'from here on out' update as far as shapes go.)

Now if a user accidentally closes the stencil with the code, then they lose functionality, but this is fairly easy to explain.

If you have real buttons on a Visio page, then they will call VBA in the document. I think it's a bit tricky to get them to call stencil in a code--you have to add a reference to the stencil, as though it were some .dll. My experience is that this often causes crashes, but I am quoting experience from 2002 and before--I've stayed away from it since. It may be much, much better now.

Excel has a more central storage for macros, you can even make a VBA add-in, so that your VBA code is sort-of installed, and users can deactivate it under File > Options > Trust Center (or something similar.)

Hope this gets you started.
LVL 11

Expert Comment

ID: 39225001
So I went ahead and tried it out. Referencing the stencil is kind of a good thing, because Visio seems to open the stencil ahead of the drawing, then hides it. So even if the user closes the docked version of the code-containing stencil, it still stays in memory and your code works.

Attached is a stencil and document. The document references the stencil's VBA project, and makes calls to it from code-behind VBA buttons. There are also shapes that call into procedures tailor-made to be called from shapes. So you have both examples.
If the drawing is distributed to a user that doesn't have the code-stencil, then an error appears declaring that Visio "Can't find project or library", which something useful that users can tell support personnel.

Can't find project or library

Author Comment

ID: 39227261
Thanks for the exciting files! Interesting and puzzling.
I tried googling "Reference to VBA utilities.vss" and found nothing of use.

I see VBA_utilities ticked in vbe/Tools/References/

However, when I opened another quite new visio drawing file in the same visio.Application instance, I could not find VBA_Utilities in the reference list which one clicks to select new references. I use Visio 2010 Premium.

Could you point me to acquiring this reference? Then Ill try reconstructing your example.

Can I reference ONE or more stencils from a vsd file?

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.


Author Comment

ID: 39228214
I wonder what sort of things this stencil system has been used for?
and how flexible it is.

The system seems ideal to enable me to establish a tool 'test site'
Say a new tool is needed - and we want to know how the new version1 performs..

Make Stencil: "myTesterStencil"
With initation modules "myTest1"; "myTest2"; ...
Provide buttons in visio RibbonX to open respective "myTest.." initiator procedures.


So I place version1 in a stencil and  connect it to a Visio Ribbon test button via 'myTest1', so others can test them from the Visio Ribbon.

Is that practicable?

LVL 11

Accepted Solution

Visio_Guy earned 500 total points
ID: 39228430
I created a new drawing, then opened the stencil. After Alt + F11 to get into the VBA editor. Then I went to Tools > References and "VBA_Utilities" was right there near the top of the list.

Author Closing Comment

ID: 39228446
Great help, thank you.

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Looking for macro to do version saving of workbooks in Excel 2016. 6 39
ADD New Entries 7 16
excel help 4 20
min values in series 13 0
Introduction While answering a recent question (http:/Q_27311462.html), I created an alternative function to the Excel Concatenate() function that you might find useful.  I tested several solutions and share the results in this article as well as t…
Freeze panes is an option within all variants of Excel to enable parts of a sheet to remain stationary when the cursor is in another part of the sheet. This is a very useful feature which is overlooked or under used.
This Micro Tutorial demonstrates in Microsoft Excel how to consolidate your marketing data by creating an interactive charts using form controls. This creates cool drop-downs for viewers of your chart to choose from.
This Micro Tutorial will demonstrate how to use a scrolling table in Microsoft Excel using the INDEX function.

867 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

17 Experts available now in Live!

Get 1:1 Help Now