Visio Guy

Visio Discussions => Visio Bugs (er...Issues) => Topic started by: Anondood on April 14, 2020, 03:48:38 PM

Title: Save .vsd as .vsdx breaks Last Edit Date in Visio 2016
Post by: Anondood on April 14, 2020, 03:48:38 PM
If I add a Last Edit Date field to an existing .vsd drawing it works as expected.

If I then save that drawing as a .vsdx, Last Edit Date shows the current time when the file is opened.

This only happens with pre-existing .vsd files.
I tried saving a 2016 file with a Last Edit Date field as .vsd (worked fine) and then saved as .vsdx (still worked fine).

I have hundreds of files that will eventually need to be updated to .vsdx.

Help! :'(

Title: Re: Save .vsd as .vsdx breaks Last Edit Date in Visio 2016
Post by: Surrogate on April 14, 2020, 04:15:04 PM
 Where is a bug in this issue?
Title: Re: Save .vsd as .vsdx breaks Last Edit Date in Visio 2016
Post by: vojo on April 14, 2020, 11:04:16 PM
last edit date needs to be a discrete / manual value....not a function like NOW().
When opening a file, that function wil update to current time.

All MS products work that way

one way you could do this in shapesheet is

user.now = NOW()
actions.updateLED = setf(getref(actions.updateLED.checked),if(actions.updateLED.checked,0,1))
actions.updateLED.tag ="update last edit date"

user.LED = if (actions.updateLED.checked, user.now, NA)

use the user.LED as the cell for the field to be displayed.

right click shape...select the "update last edit date"....will see checked and value update.
repeat and deselect to turn off (otherwise the same problem again).
Title: Re: Save .vsd as .vsdx breaks Last Edit Date in Visio 2016
Post by: Anondood on April 15, 2020, 07:07:29 AM
With my original .vsd file, after I add the Last Edit Date field it always shows the last time it was edited even if I open and close it 10 times on different days it always shows the last time it was EDITED. and not the current time.

The same behavior happens when I put a Last Edit Date field in a .vsdx.
This is all "as expected".

But if I save a .vsd as a .vsdx, the Last Edit Date field then ALWAYS shows the time the file was OPENED, even if the last edit was days ago.
Title: Re: Save .vsd as .vsdx breaks Last Edit Date in Visio 2016
Post by: Paul Herber on April 15, 2020, 07:55:22 AM
What field name are you using?
Have you tried =DOCLASTSAVE() instead of =DOCLASTEDIT() ?
I suspect Visio is writing something in the document when it is opened.

Title: Re: Save .vsd as .vsdx breaks Last Edit Date in Visio 2016
Post by: Anondood on April 15, 2020, 09:13:51 AM
From the Menu Bar:

Insert>>Field>>Date/Time>>Last Edit Date/Time
Title: Re: Save .vsd as .vsdx breaks Last Edit Date in Visio 2016
Post by: Surrogate on April 15, 2020, 09:52:13 AM
From the Menu Bar:

Insert>>Field>>Date/Time>>Last Edit Date/Time
i.e. DOCLASTEDIT (https://docs.microsoft.com/en-us/office/client-developer/visio/doclastedit-function)
Title: Re: Save .vsd as .vsdx breaks Last Edit Date in Visio 2016
Post by: Anondood on April 15, 2020, 10:28:05 AM
And how would I put that field in my drawing?

Macros, VBA, etc. are blocked in my environment.
Title: Re: Save .vsd as .vsdx breaks Last Edit Date in Visio 2016
Post by: vojo on April 15, 2020, 12:44:30 PM
in shapesheet, where ever the cell you are using in the field insertion....put that command

for example
insert==>field ==>cells ==>user.mydate
user.mydate = DOCLASTEDIT()

if you don't know shapesheet….do some google
to open, in advanced options on file panel....set enable developer mode, save.....rt click shape.
Title: Re: Save .vsd as .vsdx breaks Last Edit Date in Visio 2016
Post by: Anondood on April 15, 2020, 01:06:23 PM
When I look at the shapesheet for the .vsdx that DOESN'T work, it is already set to =DOCLASTEDIT().
The shapesheet for the original .vsd with Last Edit Date inserted is identical.

I still need to know why:
original .vsd with Last Edit Date works
original .vsdx with Last Edit Date works
.vsd converted from .vsdx works

ONLY original.vsd converted to .vsdx doesn't work
Title: Re: Save .vsd as .vsdx breaks Last Edit Date in Visio 2016
Post by: Surrogate on April 15, 2020, 01:19:45 PM
Strange in this thread (http://visguy.com/vgforum/index.php?topic=8946) mentioned another issue: dont updated value of FILENAME function.
Title: Re: Save .vsd as .vsdx breaks Last Edit Date in Visio 2016
Post by: Anondood on April 16, 2020, 11:29:24 AM
I am actually adding a FILENAME field also, but it seems to work fine after the conversion.
Title: Re: Save .vsd as .vsdx breaks Last Edit Date in Visio 2016
Post by: vojo on April 16, 2020, 06:06:39 PM
just a guess, but the conversion probably saves the new file and thus updated.   I think you really need a trigger to prevent update until you want it.  Otherwise, every time you edit, that field will get updated
Title: Re: Save .vsd as .vsdx breaks Last Edit Date in Visio 2016
Post by: Anondood on April 17, 2020, 07:11:44 AM
I WANT the field to get updated every time I edit.
I DON'T want the field to update every time I view it.

Seems simple enough, and it works as expected on everything EXCEPT converted files.
Title: Re: Save .vsd as .vsdx breaks Last Edit Date in Visio 2016
Post by: vojo on April 17, 2020, 11:04:08 AM
does a file after conversion behave correctly on the 2nd 3rd 4th time you edit?
if true, reinforces the idea conversion is about creating a new file...thus updated field
Title: Re: Save .vsd as .vsdx breaks Last Edit Date in Visio 2016
Post by: Anondood on April 17, 2020, 11:17:45 AM
NO
You can open and edit it 4 times and it always shows the time when OPENED.
I did an edit at 1010 and saved
Opened at 1011 and it showed 1011
Edited file at 1011 and saved
Opened file at 1012 and it showed 1012
and on and on . . . . .
Title: Re: Save .vsd as .vsdx breaks Last Edit Date in Visio 2016
Post by: wapperdude on April 17, 2020, 07:46:42 PM
I agree, the behavior has changed.  It is easy enough to test.

Take an existing VSD file.  Edit it to include include a shape that shows both DOCLASTEDIT() and DOCLASTSAVE().  Save.  Then Save AS VSDX.

Close the file, or Exit Visio.  Wait awhile.  Open  the VSD file, and save.  Close.  The VSD file should show different edit and save dates.  The save date should be more recent.  On V2019, this is the case.  Now open the VSDX file.  You would expect that both dates are the same.  They're not.  The DOCLASTEDIT shows the current date when the file was opened.  The Save Date is still the last time saved.

Whether or not the behavior change is intentional or not, it does exist.
Title: Re: Save .vsd as .vsdx breaks Last Edit Date in Visio 2016
Post by: Anondood on April 20, 2020, 07:41:54 AM
OK, I just verified that.

Original .vsd  --  DOCLASTEDIT() and DOCLASTSAVE() do NOT change after opening
Original .vsdx  --  DOCLASTEDIT() and DOCLASTSAVE() do NOT change after opening
Original .vsd saved as .vsdx  --  DOCLASTEDIT() ALWAYS changes to current time when opened, DOCLASTSAVE() does not change

So that proves that saving a .vsd as a .vsdx breaks DOCLASTEDIT() behavior.

So is there any way to:
a.  Prevent this from happening?
b.  "Fix" broken files?

Title: Re: Save .vsd as .vsdx breaks Last Edit Date in Visio 2016
Post by: Surrogate on April 20, 2020, 11:01:17 AM
A. IMHO, it is imposible. Because visio core change it
B. You must write macro which
1. Iterate all documents
a) get TimeEdit property
b) convert to vsdx
c) rename vsdx to zip
d) unzip this archive
e) find in one xml-document TimeEdit cell
f) replace it value to value what you get in step a.
g) save xml, and create new zip archive
h) repair this archive
i) rename to xxx.vssx