Visio 2007 - How to set the Last Edit Date to be at a page level rather than file level

Hi EE

I have a Visio 2007 with several pages describing different but related business processes.

I am seeking to set a last edit date at a page level, however the standard approach of using the menu option 'Insert > Field > Date/Time / Last Edit Date/Time' works at a whole of file level rahter than when the specific page was changed.  I would like to track the date when the individual pages were last edited, not when the file was last edited.

Can you advise how I can insert a field that will show the 'Last Edit Date' to be at a page level rather than file level?

Many thanks
FH
Flying_High_71Asked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Scott HelmersVisio Consultant, Trainer, Author, and DeveloperCommented:
I'm not aware of a way to have Visio do this for you, but you could accomplish it with some VBA code. The required code won't require rocket science but neither will it be a garden variety recorded macro. I think you'll need something like this:

Setup
Create user cell on each page to hold last edit date, e.g., User.PageChangeDate
Experiment with the Visio Event Monitor (part of the Visio SDK) to determine which Visio events will catch the kinds of changes you're interested in
Code Logic
When an event fires, determine which page contains the object that changed
Write current date to user cell defined above

As you can see the logic isn't particularly complex. The challenge will be to identify a set of events that capture the types of changes you want to know about without checking every possible event because that could affect the performance of Visio.

If you need assistance accomplishing the above, or want some sample code, just let me know.

Scott
0
Scott HelmersVisio Consultant, Trainer, Author, and DeveloperCommented:
I forgot one step under "Setup" in the post above: add a shape to each page that displays the value of the user cell, i.e., that displays the page's Last Edit date.
0
Flying_High_71Author Commented:
Hey thanks Scott

Just heading into Easter so it will be a few days before i get back to Visio to give your suggestion a crack.  Will let you know once I get back to it in a few days
0
Cloud Class® Course: Microsoft Azure 2017

Azure has a changed a lot since it was originally introduce by adding new services and features. Do you know everything you need to about Azure? This course will teach you about the Azure App Service, monitoring and application insights, DevOps, and Team Services.

Flying_High_71Author Commented:
Hi Scott

OK I am back.  

Some q's to kick off proceedings to the solution.
1. I have downloaded and installed the Visio 2007 SDK.  What this now means I have no idea, because I am not sure how that affects what I can see in the Visual Basic Editor within Visio 2007, because nothing looks any different.


2. When you say "Create user cell..." Do you mean:
 a. Create a text box
 b. Go to the menu and choose the option "Insert > Field > User-defined cells" ?
0
Scott HelmersVisio Consultant, Trainer, Author, and DeveloperCommented:
Creating a user cell involves using the Visio ShapeSheet. if you're not familiar with the ShapeSheet, take a look at this blog post from Visio MVP John Goldsmith: http://visualsignals.typepad.co.uk/vislog/2007/10/just-for-starte.html#more

A "user cell" is a row in the "User Section" of the ShapeSheet. You can use it to store data of any type.

I've experimented with this a bit this morning and haven't succeeded in finding the right combination of events that will trap what you need but won't overburden Visio with tracking zillions of little events we don't care about. I'll try to get back to this later in the week.

Don't worry about the SDK for now - we'll worry about the event monitor a bit further down the road.
0
Flying_High_71Author Commented:
Hi Scott

Did you make any progress on this.  I guess if not I may have to close it down...

cheerio
FH
0
Scott HelmersVisio Consultant, Trainer, Author, and DeveloperCommented:
Sorry -- lost this in the shuffle. I'm traveling the next couple of days but will get back to this.
0
Flying_High_71Author Commented:
No worries thanks.  I only ask because EE sent me the autogenerated 'abandoned question' so I wanted to be sure we know whether it can be done or not.
0
Scott HelmersVisio Consultant, Trainer, Author, and DeveloperCommented:
Better late than never??? Don't know whether you still need this but I've attached a document with macro code that automatically updates the "last saved" date on each page for the following events:
-- shape added
-- shape deleted
-- connection added
-- page name changed
-- data graphic added or removed
-- text changed

What it doesn't do is update for things like changing width, height, fill or shape attributes of that type. I can add that -- but it comes at a "cost" in performance. The performance might still be perfectly fine but I erred on the side of caution.
Last-edit-date-on-each-page-v01.vsd
0
Flying_High_71Author Commented:
Hi Scott

Thank you for that - certainly seems to work great, and is a far bigger macro than I would have thought required - wow - really good work.  

So I am just wondering, how the shape you have there is referred to by the Macro, i.e. "Last edit on this page: <date>" .  

I copied the macro itself just fine, but when I copy the shape, I get the dreaded "Visio Internal Error: #-1 Action 1021:Copy", to which the only work around I am aware of is an upgrade to Visio 2010.  We are using Visio 2007.

So if you could advise how I create my own shape to which the macro could refer, it would round this one out nicely.  

FH
0
Scott HelmersVisio Consultant, Trainer, Author, and DeveloperCommented:
Actually, the macro doesn't update the shape on each page directly -- it uses a bit of Visio sleight of hand:
Each page contains a cell called "LastEditDate" in the User section of the ShapeSheet
The macro updates the user cell
The shape on the page includes a field that displays the contents of the user cell (plus a bit of text)
Consequently, your diagram requires two things:
Each page must contain User.LastEditDate
The shape that displays the date must contain a formula something like
="Last edit on this page: "&ThePage!User.LastEditDate
If you need help creating the user cells or inserting a field into a shape, just let me know -- neither is routine Visio knowledge though both will add to your "power user" skill set.

BTW, there is nothing in the macro that is version specific so it will run correctly with Visio 2007.
=  =  =  =  =  =  =  =  =  =  =  =  =  =
Addendum: I just learned something useful. When you copy a shape containing a field that references the User.LastEditDate cell in the page, Visio automatically adds the cell to the page. Consequently, you should be able to copy my shape to any page in another document and the appropriate cell will be added for you. In your previous response you said you received an error; was that when you were pasting my shape into your document or at some other moment?
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Flying_High_71Author Commented:
Great! So I will recap what I did in my Visio 2007.

For the ShapeSheet:
1. I opened the Visio menu Window > Show Shapesheet
2. The ShapeSheet window opened
3. I scrolled down to the section "User defined cells"
4. I right clicked in that section and selected the option "Insert Row"
5. In the new row, I added the cell User.LastEditDate and also added a default value
6. Save

For the macro:
1. I opened the Visio menu Tools > Macro > Visual Basic Editor
2. I copy and pasted the macro you provided in your attachment above into my Visual Basic Editor Window
3. I edited the subroutine "Sub UpdateLastEditCell(pg As Visio.Page)" to change the date format as required

For the shape iteself (in each sheet):
1. I created a new shape
2. I inserted a field using the menu option Insert > Field
3. In the dialog box that opens, under Category, I selected the option 'Custom Formula'
4. I entered a formula that read ="Last edit on this page: "&ThePage!User.LastEditDate

Presto! The field appears and now tracks the necessary changes.  Really happy with this outcome, but who would have thought this need be so much work...?

Now as regards your Addendum:
I too have found that if I copy the shape containing a field that references the User.LastEditDate cell in the page, Visio automatically adds the ShapeSheet cell to the page i.e. to the ShapeSheet.  However this is from the one I created using the above steps.  If I copy the one provided in the attachment, I seem to get the error above, at the point where I copy the shape i.e. inside your document.  

***
At any rate, the information you have provided is great and resolved this little black duck's problem, and taken me one step further to being an <ahem>  ...power... user and I use that term very loosely for mine :-)

Many thanks!
FH
0
Scott HelmersVisio Consultant, Trainer, Author, and DeveloperCommented:
You're quite welcome. I enjoy working on problems that involve something I haven't done before.

And thanks to you for posting the excellent recap. It will certainly help someone in the future who wants to accomplish the same thing.
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Microsoft Visio

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.