Author Topic: Store Macro Code on the Internet  (Read 15399 times)

0 Members and 1 Guest are viewing this topic.


  • Newbie
  • *
  • Posts: 5
Store Macro Code on the Internet
« on: September 09, 2015, 10:30:53 AM »

I'm interested in deploying a macro i've written to a number of customers but instead of sending them code I'm wondering if there's anyway that the code can be kept on a webserver and pulled down by the Visio client when needed.  This would then mean that I have only to update the code centrally and not send out to every customer.  I'm guessing that this would require a small macro on the client that refers to the location of the full code stored on t'internet ?

Has anybody tried anything like this before ?  If its not possible, what is the best way to accomplish this distribution of macros ?  Its written in VBA (which I'm guessing isn't the best for distribution options etc).  What code should I use, if I decide to rewrite ?

Thanks for any assistance,


  • Hero Member
  • *****
  • Posts: 1778
    • ShapeSheet™ Knowledge Base
Re: Store Macro Code on the Internet
« Reply #1 on: September 09, 2015, 10:52:44 AM »
same topic about 2 years ago
I think the following could make sense:

An online code repository for macroces or macro-commands / snippets can be done.


  • Hero Member
  • *****
  • Posts: 3153
Re: Store Macro Code on the Internet
« Reply #2 on: September 09, 2015, 01:12:37 PM »
No, Rob is distributing this to clients. Would be a bad idea to send code.
Either write a propper addin (Nikolay has published some very nice tools in the forum), or at least pack the macros in a stencil.


  • Hero Member
  • *****
  • Posts: 1239
    • UnmanagedVisio
Re: Store Macro Code on the Internet
« Reply #3 on: September 10, 2015, 07:34:03 AM »
Yes, I had this idea, but now implementation is almost as far away as it was one year ago.

I.e. the idea was that you have an add-in where you can put some VBA and saves it online as github gist for example,
and then your users (who have the same addin installed) can just run it (for the active document, for active shape, whatever). Or edit/adopt it somehow. Like "Apps for Office" (which don't work with Visio), but more lightweight. With that one could get "for free" deployment, versioning of the code, user access control, macro-free documents, and some ease of use (users may become a button/keyboard shortcut to run it automatically so you don't need to mess with UI or with explaining stuff).
« Last Edit: September 10, 2015, 07:36:10 AM by Nikolay »

Hey Ken

  • Full Member
  • ***
  • Posts: 233
  • Just This Guy
    • The Pennsylvania Project, with Ken Krawchuk
Re: Store Macro Code on the Internet
« Reply #4 on: September 10, 2015, 08:25:48 AM »

   Interesting suggestion, deploying code from the web.   Not sure how to do that; I've been using another way to distribute code: via the stencil.

   It’s a technique I learned here a few years back, and I’ve been using it ever since.   The idea is to put your code into a stencil, then distribute the stencil.  When it’s time for a code update, I just give everyone a new stencil and tell them to throw away the old one.  Not as elegant as downloading on demand from the web, but it does work.  I posted the details here a few years ago about how I go about it, and I’ve found the approach to be very flexible.  It might be a good Plan B for you if you can’t find a way to download your code.

   Now that you got me thinking about it, perhaps you could use a stencil-based solution to download your code.  Put a small VBA routine in the stencil (as you suggested) that triggers on the document open event.  Whenever you open the stencil, it downloads your code from some .txt document you have on the web somewhere, then stores it in ThisDocument or some other module in the Visio drawing.

   I did something similar with a Visio VBA macro I wrote that programmatically creates and populates an Excel spreadsheet from within a Visio drawing, then copies a bunch of Excel VBA code from the stencil into the spreadsheet.  Sounds simple, but it has a lot of odd twists and turns.  Details of the self-coding technique came from a pretty exhaustive post on the topic from Chip Pearson.  One caveat: For it to work you need to have the users check an obscure option in the Trust Center, “Trust Access to the Visual Basic Project”.  That could be a security concern.  Worse yet, in some environments (like my current one) the Powers That Be have disabled all programmatic access to the VB project, which stops you from copying any code at all.  That could be a show-stopper for your plan to download code; but distributing code via the stencil would still work regardless.

   Of course now that you got me thinking about a possible viable solution for downloading from the web, I’ll have to try it.  In my copious free time...

   - Ken

Ken V. Krawchuk
No Dogs on Mars - A Starship Story


  • Newbie
  • *
  • Posts: 5
Re: Store Macro Code on the Internet
« Reply #5 on: September 10, 2015, 09:54:58 AM »
Thanks for the replies and idea guys.

I'll have a think and a play around and let you know my findings.



  • Sr. Member
  • ****
  • Posts: 326
    • PC Mimic Diagram
Re: Store Macro Code on the Internet
« Reply #6 on: September 11, 2015, 05:44:55 AM »
You may also fall foul if you are code signing, as the code signing certificate would need to be installed to save the updated code.
Live life with an open mind


  • Jr. Member
  • **
  • Posts: 35
Re: Store Macro Code on the Internet
« Reply #7 on: July 08, 2016, 01:40:15 PM »
Thanks for the problem i got the same