Visio Guy

Visio Discussions => Programming & Code => Topic started by: vickey on October 17, 2016, 12:29:01 PM

Title: Dynamic updating of code in a template or drawing
Post by: vickey on October 17, 2016, 12:29:01 PM
Hi,

I have written my code  and macros in developer mode of a drawing.
and every time when a user is creating a new drawing I am just creating a copy of that drawing in the background.
but now my problem is that suppose i have 30-40 drawings created and all of those drawings have the same code written in the developer mode.
But if there is some bug in the code or new improvisation in the code or macro then I need to open each and every drawing in developer mode and update its code, which is very time taking and in future I may have more than 1000 of drawings.
So is there some way that i write my code once in a template or a drawing and it automatically updates the code of all the drawings created previously.
Seeking forward for your replies, I am really stuck at this issue.

Thanks in advance,
Vickey
Title: Re: Dynamic updating of code in a template or drawing
Post by: Hey Ken on October 17, 2016, 12:53:28 PM
Vickey:

    Just put your code in a stencil, and distribute that.  You can either just distribute new code as you develop it, or take it a step further and update shapes and stuff.  It's a trick I learned here, and expanded upon ('wrestled with" may be a better description).  But it works very well.  Details at http://visguy.com/vgforum/index.php?topic=4710 (http://visguy.com/vgforum/index.php?topic=4710).

    Hope this helps,

    - Ken


Title: Re: Dynamic updating of code in a template or drawing
Post by: vojo on October 19, 2016, 02:03:25 AM
well wont quite fix that

Shape is copied from stencil to drawing stencil then used.  So
if drawing is done with stencil "cool stuf 2016 10 18"
then 3 months later you fix the bug with stencil "cool stuf 2017 01 15"
Drawing (at least shapes) wont change.

My guestimate, but you would need to rerun any stencil VBA in 01 15 to get changes
(obviously care must be taken that VBA in 01 15 works with stuff in 10 18)

If indeed this is the case, you might be better off making a "pure" VBA stencil
This approach will force the VBA to discover shapes, make changes, etc....ie an orderly disciplined approach
(no sloppy coding RE "hey I wrote this assuming only this stencil")
Browser ID: smf (is_webkit)
Templates: 1: Printpage (default).
Sub templates: 4: init, print_above, main, print_below.
Language files: 1: index+Modifications.english (default).
Style sheets: 0: .
Hooks called: 50 (show)
Files included: 25 - 925KB. (show)
Memory used: 748KB.
Tokens: post-login.
Cache hits: 8: 0.00095s for 22,292 bytes (show)
Cache misses: 3: (show)
Queries used: 12.

[Show Queries]