Solved

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

Posted on 2012-04-03
13
1,759 Views
Last Modified: 2012-07-08
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
0
Comment
Question by:Flying_High_71
  • 7
  • 6
13 Comments
 
LVL 30

Expert Comment

by:Scott Helmers
Comment Utility
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
 
LVL 30

Expert Comment

by:Scott Helmers
Comment Utility
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
 

Author Comment

by:Flying_High_71
Comment Utility
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
 

Author Comment

by:Flying_High_71
Comment Utility
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
 
LVL 30

Expert Comment

by:Scott Helmers
Comment Utility
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
 

Author Comment

by:Flying_High_71
Comment Utility
Hi Scott

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

cheerio
FH
0
Do You Know the 4 Main Threat Actor Types?

Do you know the main threat actor types? Most attackers fall into one of four categories, each with their own favored tactics, techniques, and procedures.

 
LVL 30

Expert Comment

by:Scott Helmers
Comment Utility
Sorry -- lost this in the shuffle. I'm traveling the next couple of days but will get back to this.
0
 

Author Comment

by:Flying_High_71
Comment Utility
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
 
LVL 30

Expert Comment

by:Scott Helmers
Comment Utility
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
 

Author Comment

by:Flying_High_71
Comment Utility
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
 
LVL 30

Accepted Solution

by:
Scott Helmers earned 500 total points
Comment Utility
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
 

Author Comment

by:Flying_High_71
Comment Utility
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
 
LVL 30

Expert Comment

by:Scott Helmers
Comment Utility
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

Featured Post

Free Trending Threat Insights Every Day

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

Join & Write a Comment

Suggested Solutions

Title # Comments Views Activity
Visio Stencils Needed 2 537
can't attach visio file to gmail message 4 135
Visio custom numbering 2 38
Visio-like drawings in Powerpoint 9 60
A recent Visio zone question asked how to use the data in an Excel file to create a Visio Gantt chart -- and then to dynamically update the Gantt chart. The good news is that the Viso Gantt Chart wizard can be automated. The bad news is that the…
Scott A. Helmers Partner, Harvard Computing Group Microsoft Visio MVP Background Microsoft has added more enhancements and new features to Visio 2010 than to any release since they purchased the Visio product line in 2000. In addition, the com…
Illustrator's Shape Builder tool will let you combine shapes visually and interactively. This video shows the Mac version, but the tool works the same way in Windows. To follow along with this video, you can draw your own shapes or download the file…
Access reports are powerful and flexible. Learn how to create a query and then a grouped report using the wizard. Modify the report design after the wizard is done to make it look better. There will be another video to explain how to put the final p…

744 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

18 Experts available now in Live!

Get 1:1 Help Now