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

Comment Utility
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

Comment Utility
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

Comment Utility
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?

Enabling OSINT in Activity Based Intelligence

Activity based intelligence (ABI) requires access to all available sources of data. Recorded Future allows analysts to observe structured data on the open, deep, and dark web.


Author Comment

Comment Utility
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
Comment Utility
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

Comment Utility
Great help, thank you.

Featured Post

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

Suggested Solutions

Title # Comments Views Activity
Excel 2013 Problem 12 44
Excel 2010 - Text not aligning at bottom of cell! 5 16
TT Column Arrange 10 25
Convert .PDF 6 37
Improved? Move/Copy Add-in Replacement - How to avoid the annoying, “A formula or sheet you want to move or copy contains the name XXX, which already exists on the destination worksheet.” David Miller (dlmille)  It was one of those days… I wa…
This code takes an Excel list of URL’s and adds a header titled “URL List”. It then searches through all URL’s in column “A”, looking for duplicates. When a duplicate is found, it is moved to the top of the list. The duplicate URL’s are then highlig…
This Micro Tutorial will demonstrate how to use longer labels with horizontal bar charts instead of the vertical column chart.
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.

763 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

10 Experts available now in Live!

Get 1:1 Help Now