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.

Rawb0

Hi,

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,
Rob.

Surrogate

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.

Yacine

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

Nikolay

#3
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

Rawb0:

   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
Author
No Dogs on Mars - A Starship Story
http://astarshipstory.com

Rawb0

Thanks for the replies and idea guys.

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

Cheers,
Rob.

AndyW

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

jfvert

Thanks for the problem i got the same