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?

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.


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

Free Tool: Postgres Monitoring System

A PHP and Perl based system to collect and display usage statistics from PostgreSQL databases.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

When you see single cell contains number and text, and you have to get any date out of it seems like cracking our heads.
Do you use a spreadsheet like Microsoft's Excel?  Have you ever wanted to link out to a non excel file on your computer or network drive?  This is the way I found to do it!
Graphs within dashboards are meant to be dynamic, representing data from a period of time that will change each time the dashboard is updated with new data. Rather than update each graph to point to a different set within a static set of data, t…
This Micro Tutorial will demonstrate the scrolling table in Microsoft Excel using the INDEX function.

790 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