Visio Guy

Visio Discussions => General Visio => Topic started by: Yacine on July 30, 2014, 07:57:25 PM

Title: Stencils asking for saving when drawing is closed -even they were not edited
Post by: Yacine on July 30, 2014, 07:57:25 PM
Does one of you guys has an idea why a stencil would ask me if I want to save it, when it was just editing the drawing and not having set the stencil in edit mode?

I unfortunately cannot upload the stencil as it contains code, that I don't own.

The thing is, I have a stencil that I must have altered in way, that it asks for saving.

I have no idea, where to look. Does anyone have a small idea?
Title: Re: Stencils asking for saving when drawing is closed -even they were not edited
Post by: wapperdude on July 31, 2014, 12:16:44 AM
1st the dumb question...can you say no, exit without saving?

Do you have access to or a copy of the original?  I ask in case you need to recover the original stencil.

You could try saving with a different name.  That ought to take care of the changes and leave the original unchanged...hopefully.  You could then compare file statistics in Windows Explorer, ultimately deleting the modified version.

HTH
Wapperdude
Title: Re: Stencils asking for saving when drawing is closed -even they were not edited
Post by: Yacine on July 31, 2014, 05:24:40 AM
Yes I can exit without saving, but it's anoying.
I will try your suggestion. May be it's really just a "file" thing.
Thanks.
Title: Re: Stencils asking for saving when drawing is closed -even they were not edited
Post by: JuneTheSecond on July 31, 2014, 05:30:37 AM
Are you sure your code in your stencil does not edit your stencil?
Title: Re: Stencils asking for saving when drawing is closed -even they were not edited
Post by: Yacine on July 31, 2014, 07:06:55 AM
QuoteAre you sure your code in your stencil does not edit your stencil?
To my knowledge it is not possible for a VBA program to edit code. You can do this only from outside the project.

Would you happen to know what kind of code could do this modification?
Title: Re: Stencils asking for saving when drawing is closed -even they were not edited
Post by: Jumpy on July 31, 2014, 07:27:09 AM
Yunichi is talking about code, that changes the stencil or opens it in edit mode, not code changing code.

But to still answer the question: Changing VBA code with VBA code:
This explanation is for Excel, but I still think, it applies for Visio, too:

http://www.cpearson.com/excel/vbe.aspx

Title: Re: Stencils asking for saving when drawing is closed -even they were not edited
Post by: Yacine on July 31, 2014, 08:57:13 PM
Hi Jumpy,
right, I did not read carefully enough Junichi's post.
But! I did changes - when I wrote them only God and myself knew them - know only God does.
But I definitely did not code anything on purpose, that would modify the stencil in any way.
Title: Re: Stencils asking for saving when drawing is closed -even they were not edited
Post by: Jumpy on August 01, 2014, 01:56:51 PM
Maybe you somewhere check if stencil is not open, than you open it with code using maybe OpenEx with a wrong parameter, to open in edit mode? A lot of maybes, I know, but can't think of another scenario without seeing some code.
Title: Re: Stencils asking for saving when drawing is closed -even they were not edited
Post by: daihashi on September 01, 2014, 09:38:51 PM
Quote from: Yacine on July 31, 2014, 07:06:55 AM
QuoteAre you sure your code in your stencil does not edit your stencil?
To my knowledge it is not possible for a VBA program to edit code. You can do this only from outside the project.

Would you happen to know what kind of code could do this modification?

I know this is kind of an old post, but you can actually edit code using VBA. I did this for a while, but it was not 100% predictable/reliable. So instead I opted to include an "update" button that would appear when I made an actual version update available; a msgbox would also pop up upon document open to notify the user of an available update, and the end user could simply click it if they wished. This method basically would copy modules, forms, classes, etc. from the stencil document to the local document.

The latter method is far more reliable for my use, and allows the user to update when they want to do it; as opposed to the document taking control and locking the screen while VBA updated code... which I imagine was scary for some users.
Title: Re: Stencils asking for saving when drawing is closed -even they were not edited
Post by: daihashi on September 01, 2014, 09:45:11 PM
regarding your actual question. Make sure that the properties of the stencil file has "saved" set for True.

Also; here is the code I use in my templates to open the stencil file upon document open (after it downloads the stencil from my server). I had some initial issues with being randomly prompted to save the stencil file, but I no longer have this problem after I started checking the .vss saved properties being set for true... and used the open method listed below.

I'd have to go back and look at my older stencil files, but I think what was causing a save prompt before was that I used "visOpenRW"... or something along those lines, instead of the code shown below.

Application.Documents.OpenEx libraryPATH & libraryFILE, visOpenDocked + visOpenHidden