BB code in posts seems to be working again!
I haven't turned on every single tag, so please let me know if there are any that are used/needed but not activated.

Main Menu

Store Macro Code on the Internet

Started by Rawb0, September 09, 2015, 03:30:53 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.



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,


same topic about 2 years ago
Quote from: Nikolay on December 07, 2013, 03:55:17 PM
I think the following could make sense:

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


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.


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).

Hey Ken


   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


Thanks for the replies and idea guys.

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



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


Thanks for the problem i got the same

Browser ID: smf (possibly_robot)
Templates: 4: index (default), Display (default), GenericControls (default), GenericControls (default).
Sub templates: 6: init, html_above, body_above, main, body_below, html_below.
Language files: 4: index+Modifications.english (default), Post.english (default), Editor.english (default), Drafts.english (default).
Style sheets: 4: index.css, attachments.css, jquery.sceditor.css, responsive.css.
Hooks called: 313 (show)
Files included: 40 - 1775KB. (show)
Memory used: 1384KB.
Tokens: post-login.
Cache hits: 14: 0.00169s for 26,766 bytes (show)
Cache misses: 3: (show)
Queries used: 15.

[Show Queries]