Improve company productivity with a Business Account.Sign Up

  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 558
  • Last Modified:

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

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?

  • 3
  • 3
1 Solution
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.
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
Kelvin4Author Commented:
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: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

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.

Kelvin4Author Commented:
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?

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.
Kelvin4Author Commented:
Great help, thank you.
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Get your problem seen by more experts

Be seen. Boost your question’s priority for more expert views and faster solutions

  • 3
  • 3
Tackle projects and never again get stuck behind a technical roadblock.
Join Now