Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
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
Medium Priority
?
2,153 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 7
  • 6
13 Comments
 
LVL 31

Expert Comment

by:Scott Helmers
ID: 37810699
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 31

Expert Comment

by:Scott Helmers
ID: 37810707
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
ID: 37811780
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
Get your Disaster Recovery as a Service basics

Disaster Recovery as a Service is one go-to solution that revolutionizes DR planning. Implementing DRaaS could be an efficient process, easily accessible to non-DR experts. Learn about monitoring, testing, executing failovers and failbacks to ensure a "healthy" DR environment.

 

Author Comment

by:Flying_High_71
ID: 37825798
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 31

Expert Comment

by:Scott Helmers
ID: 37827737
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
ID: 37890412
Hi Scott

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

cheerio
FH
0
 
LVL 31

Expert Comment

by:Scott Helmers
ID: 37891924
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
ID: 37894809
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 31

Expert Comment

by:Scott Helmers
ID: 38157938
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
ID: 38158134
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 31

Accepted Solution

by:
Scott Helmers earned 2000 total points
ID: 38159576
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
ID: 38165266
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 31

Expert Comment

by:Scott Helmers
ID: 38165339
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

Efficient way to get backups off site to Azure

This user guide provides instructions on how to deploy and configure both a StoneFly Scale Out NAS Enterprise Cloud Drive virtual machine and Veeam Cloud Connect in the Microsoft Azure Cloud.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Have you ever created a custom Visio stencil – a collection of your own unique master shapes – and then created a drawing by dragging masters onto the drawing page? Have you then made changes to the stencil master and wondered why the shapes on the …
The ability to add structure to Visio diagrams using containers, lists and callouts is one of my favorite features in Visio 2010. In this article we’ll examine lists. We’ll explore containers and callouts in separate articles. Prior to reading th…
Sometimes it takes a new vantage point, apart from our everyday security practices, to truly see our Active Directory (AD) vulnerabilities. We get used to implementing the same techniques and checking the same areas for a breach. This pattern can re…
How to fix incompatible JVM issue while installing Eclipse While installing Eclipse in windows, got one error like above and unable to proceed with the installation. This video describes how to successfully install Eclipse. How to solve incompa…

610 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